-
Notifications
You must be signed in to change notification settings - Fork 398
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
Fix: Add id_token grant flow #189
Conversation
ac6f095
to
6d513f0
Compare
dda0450
to
d781e7c
Compare
d781e7c
to
531e7ae
Compare
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 couple of small things, but overall looks ace
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.
perfect! will leave you to merge it when you ready
Hi @kangmingtay, any update on when this will get merged? Super keen for this feature. |
Same here! |
Hey @He1nr1chK , @libovness, we are working on a refactor here that will fix a couple of issues with the "Sign-up with an external OAuth provider" flow so this PR is unlikely to be merged yet. Some of the issues we aim to fix before introducing more sign-up flows (like this one) would be the following:
In term of timeline, I'm hoping to get the refactoring work done by this week and make the necessary changes to this PR next week. Thanks for understanding! |
hi @kangmingtay checking in to see if the PR will happen this week? |
Looks very exciting, crossing fingers for a quick merge 🤞 |
Any updates/timeline? I'm excited to integrate these changes with the iOS libraries so we can support Sign in With Apple |
gm |
Hey @libovness, @thecoolwinter, @10000multiplier, @He1nr1chK, @k0shk0sh, apologies for the delay, i'm still testing out this feature on my end and have some questions regarding the auth flow for ios / android:
Just to provide some context: Ideally, we want a developer to be able to create a mobile and web app for the same product that uses the same auth server (gotrue) for user authentication. Currently, this implementation doesn't allow for one to build a mobile and web app for the same project using supabase. Based on what i've investigated so far, for sign-in with apple, there's a slight difference between the IOS and web flow.
The issue arises when validating the
Since the "Apple Client ID" maps to the identifier for the "Service ID" created, only sign-in with apple via web will be allowed. Once again, apologies for the delay in getting this out. Was pretty busy with the refactoring work in the last month and just got back from a trip this week 😅 Thanks so much for the patience so far! |
I don't think that will be a problem. For iOS the App ID and Service ID are separate things, but are linkable. To set up SWIA I would go and make a new app and set its Bundle ID, then create a Service ID. When creating that Service ID I'll actually link the Service ID to the bundle ID that I just created. So the Service ID can be used for the same mobile and web app. Actually, the Service ID can be linked to any number of Bundle IDs or web IDs by grouping their identifiers so that won't be a problem at all. Thank you for all your hard work 🙏 this is awesome! |
@thecoolwinter Hmm based on my understanding, the "Service ID" only needs to be created when you want to have an accompanying website to your IOS app. By default, the IOS app will use the bundle ID for SIWA. Enabling SIWA on the "Service ID" then grants permissions for users to SIWA on the website. This uses the identifier in the "Service ID" which is different from the bundle ID. |
Don't apologise for doing us all a huge favour @kangmingtay, I would have looked into doing this myself but honestly was too lazy. Keep up the good work. Looking forward to using this in the near future. Let me know if this reply helps at all, if not I will gladly assist in any other way I can. |
Here is an abridged example of the Apple sign in version
Google would look like this:
And finally Facebook:
Sorry for the long reply @kangmingtay, hopefully it makes your life a bit easier. P.S. don't scrutinise the code too harshly left out some try catch's etc. for brevity's sake. |
Hi @kangmingtay, any updates? |
Hi everyone, it's been a long wait and i'm happy to announce that we'll be merging this feature into gotrue, and releasing it to all supabase projects in the upcoming week. Do note that this endpoint is still in alpha and thus susceptible to changes. Thanks to everyone for the patience and valuable insights in terms of helping me understand the issues the mobile community has been facing so far! |
🎉 This PR is included in version 2.2.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
hi, @kangmingtay does this require updating the supabase dart library to access the end point? |
* chore: add go-oidc package * fix: add id token grant flow * fix: add check for valid aud * chore: improve error msg for query error * chore: check if provider is enabled * fix: add ios bundle id config * fix: update id_token grant flow to match on provider_id
What kind of change does this PR introduce?
Allows a user to send an id_token & a nonce via
POST /token?grant_type=id_token
to signup / signin a userContext
Some native mobile frameworks (such as Swift UI Authentication Services, Expo AuthSession) support their own existing OAuth2.0 authorization flow. The most common (and recommended) OAuth flow for native apps is the Authorization Code flow with proof of key for code exchange.
What is the current behavior?
Currently, mobile developers that make use of their respective native frameworks for auth have difficulties integrating with gotrue.
What is the new behavior?
Mobile developers can use their own native frameworks for auth and send the id_token to gotrue via
POST /token?grant_type=id_token
endpoint to register a user in the auth schema. This partially addresses #140 and #198.Example
Limitations
Since the
id_token
is specific to the OpenID Connect (OIDC) standard, this new endpoint will only be able to support OIDC compliant providers for the meantime.How the overall flow would look like