-
Notifications
You must be signed in to change notification settings - Fork 16
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
token changed callback #42
Conversation
1af2062
to
eea29e1
Compare
@pavanjoshi914 can you please update the README with a section on how to subscribe to token changes? |
event function will return empty promises onwards signed-off-by: pavan joshi <pavanj914@gmail.com>
shift emitting event in refreshAccessToken itself handle types emit events even when user manually refreshes token signed-off-by: pavan joshi <pavanj914@gmail.com>
src/OAuth2User.ts
Outdated
@@ -84,8 +98,11 @@ export class OAuth2User implements OAuthClient { | |||
const token = processTokenResponse(data); | |||
this.token = token; | |||
resolve({token}); | |||
this._tokenEvents.emit("tokens", this.token); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also add a verb here? (like in tokenRefresh, accountChange, ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
@pavanjoshi914 can you test these changes with the Alby extension using yarn link? using these callbacks should be much cleaner than the current solution. |
change event name to tokenRefreshed signed-off-by: pavan joshi <pavanj914@gmail.com>
good for me. @rolznz feel free to merge it. |
Fixes #31