Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mini-Program support. #44

Merged

Conversation

aojiaotage
Copy link
Contributor

Supported Wechat-Mini-Program OAuth, or OAuth like mechanism, since we just need a small part of the whole OAuth protocol to support mini-program, which simplified the auth procedure for server.

The only thing need to be done when trying to use mini-program OAuth is to pass a isMiniProgram param as the fifth param in the constructor.

Simple unit tests and doc changes are also included in this PR.

Plz tell me if any further work need to be done.

@coveralls
Copy link

Coverage Status

Coverage decreased (-13.9%) to 76.623% when pulling d543d6d on aojiaotage:feature/mini-program-support into 0cd122a on node-webot:master.

@coveralls
Copy link

coveralls commented Apr 17, 2018

Coverage Status

Coverage increased (+1.7%) to 92.208% when pulling c1212b3 on aojiaotage:feature/mini-program-support into 0cd122a on node-webot:master.

lib/oauth.js Outdated
var user = decrypter.decryptData(options.encryptedData, options.iv);
return callback(null, user);
}catch (e) {
return callback(new Error('error occurred when trying to decrypt mini-program user data'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try {
  callback();
} catch(ex) {
  callback();
}

是一种不好的范式。当 callback 中出错时, callback 会被调用2次。

@JacksonTian
Copy link
Member

There is a change need to be done, see comments.

Thanks for you contribution.

@JacksonTian JacksonTian merged commit 3a9c210 into node-webot:master Apr 24, 2018
@aojiaotage aojiaotage deleted the feature/mini-program-support branch April 24, 2018 07:15
@JacksonTian
Copy link
Member

Could you please port the implement to co-wechat-oauth ?

@JacksonTian
Copy link
Member

I have released the feature to NPM. 1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants