-
Notifications
You must be signed in to change notification settings - Fork 240
Enable login via oauth #229
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
base: staging
Are you sure you want to change the base?
Conversation
|
@igorbenav please have a look, I think the pattern looks OK, but perhaps is trusting fastapi-sso too much?? l do like the use of the OpenID object though, but for example there is a bug in the microsoft provider that will require a PR in fastapi-sso (I will do that soon). |
…user password i null/None
| """ | ||
| if not oauth_user.email: | ||
| raise UnauthorizedException(f"Invalid response from {self.provider_name.title()} OAuth.") | ||
| username = oauth_user.email.split("@")[0] |
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.
Isn't there any sort of collision handling here?
| router.include_router(tasks_router) | ||
| router.include_router(tiers_router) | ||
| router.include_router(rate_limits_router) | ||
| router.include_router(users_router) |
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.
Any reason for this order change?
| } | ||
|
|
||
|
|
||
| class GithubSSOProvider(BaseOAuthProvider): |
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.
Why is github the only one named with "SSO" instead of OAuth?
| ) | ||
| return access_token | ||
|
|
||
| async def _login_handler(self): |
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.
missing return type
igorbenav
left a comment
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.
Just a few things that need addressing or answering, plus remove inline comments please (you can use docstrings to document decisions if necessary).
Good PR overall, thanks
This is a WIP because there are some bugs in the underlying fastapi-sso library and there is still missing code in this PR to address robustness, since oauth has to be quite air tight there are a log of exceptions to consider.
For the moment this draft PR adds the patterns to create an oauth provider to the application.
Google, GitHub oauth should be working as is, I tested it.