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

Consolidate API requests authed with bearer to a single function call #279

Merged
merged 4 commits into from
Aug 14, 2019

Conversation

petschekr
Copy link
Member

Also finally fixes problems with logout not being communicated to Ground Truth

A continuation of #276


req.end();
// Invalidates token and logs user out of Ground Truth too
await GroundTruthStrategy.apiRequest("POST", new URL("/api/user/logout", groundTruthURL).toString(), user.token || "");
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to log the user out of GT if they log out of registration? CAS (ie login.gatech.edu) would typically keep you logged in but redirect you to a page that gives you the option to completely log out of the CAS.

Copy link
Member Author

Choose a reason for hiding this comment

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

I implemented it this way because typically people want to sign out of registration + Ground Truth (i.e. to switch accounts or for security or whatever) when they click "Log out" from within registration and combining it into a single, automatic step seemed easier. I don't really see a use case for wanting to log out of registration but not Ground Truth

reject(error);
}
else {
resolve(body as string);
Copy link
Member

Choose a reason for hiding this comment

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

Do we have some endpoints that don't return JSON?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point - updated method to always return parsed JSON

Copy link
Member

@ehsanmasdar ehsanmasdar left a comment

Choose a reason for hiding this comment

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

LGTM

@petschekr petschekr merged commit fa93929 into master Aug 14, 2019
@ayush-goyal ayush-goyal deleted the fix-bearer-calls branch December 29, 2020 03:40
rahulrajus pushed a commit that referenced this pull request Jul 22, 2021
Consolidate API requests authed with bearer to a single function call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants