-
Notifications
You must be signed in to change notification settings - Fork 6
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
Sugar client: fix Panoptes authentication #142
Conversation
Missed in #135: Promise.all should take an array as an argument. I've also added better error-logging to debug Sugar client errors.
Marking this as draft because I'm seeing panoptes-javascript-client/lib/sugar.js Lines 25 to 27 in bfce5ae
|
Instead of checking the session and token in parallel, check the token after the user has resolved.
Switching from |
sugarClient.authToken = token; | ||
auth.checkBearerToken() | ||
.then(function (token) { | ||
sugarClient.authToken = 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.
I believe the sugar.connect() (below) needs to be in this promise then block to ensure the connection is after the token is setup
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.
Good catch. I've fixed that and I'm seeing myself show up under the Active Participants heading on Talk.
Wait for auth to complete before connecting to Sugar.
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.
LGTM
Missed in #135:
Promise.all
should take an array as an argument. I've also added better error-logging to debug Sugar client errors.