-
Notifications
You must be signed in to change notification settings - Fork 895
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
feat: add third party integrations #577
Conversation
Currently the new third party sign in buttons don't have a loading state. When I click one of them it takes a while on my end before I get redirected (~3 sec). Would suggest to add a loading state, because I think it would feel a bit more dynamic. Also the other input elements should be disabled. |
Co-authored-by: bjoern-m <56024829+bjoern-m@users.noreply.github.com>
Should we export the |
Yes, I think we should. |
|
|
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.
Nicely done! Approved from my side.
Description
Adds support for OAuth-based social/third party login. First supported providers are Google and GitHub only.
Implementation
thirdparty/auth
API endpoint which redirects to the third party provider.Provider
implementations build authorization code endpoint URL for the respective provider and redirect.thirdparty/callback
API endpoint, which is called by the third party provider with an authorization code (or an error).Provider
implementations exchange the authorization code for an access token and use this access token to retrieve user data.linking.go
) for determining whether an account has to be created with Hanko and linked to a provider. Third party provider account links are persisted asidentities
that are in turn linked to an email address. Main requirements for the linking logic were:email
FK constraint in theidentity
schema. Drawback is that we lose possibility for more granular audit logs: when you delete an email, audit logs will tell you just that, but not that an identity was removed.Tests
I could not get a grasp on how to use our "fake" persistence layer to properly test a majority (i.e. the "linking") of the code. This "fake" layer does not accurately mimic what our real DB layer does. More specifically: it cannot fetch associations (unless they are refactored/rebuilt such that they can - I tried that, I gave up).
How to test
Additional context