feat: Add FlutterWebAuth2RedirectRoute for OAuth2 PKCE web sign-in flow#5133
Open
vfiruz97 wants to merge 2 commits into
Open
feat: Add FlutterWebAuth2RedirectRoute for OAuth2 PKCE web sign-in flow#5133vfiruz97 wants to merge 2 commits into
vfiruz97 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Regarding @vlidholt comment in serverpod/serverpod_docs#494 (comment). This PR adds
FlutterWebAuth2RedirectRoutefor genericOAuth2web sign-in flow.Users have to call
pod.configureOAuth2WebRedirectRoute();beforepod.start()instead of puttingweb/auth.htmlin setup Idp. This route that serves some Identity Providers callback. By default it serves in/auth/callbackpath but user can set hispathandhost.NOTE: This route should be in the same
hostwith frontend app.This route is provider-agnostic — register it once and share it across all OAuth2 PKCE-based identity providers (Google, GitHub, Microsoft, etc.).
Pre-launch Checklist
///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.If you need help, consider asking for advice on the discussion board.
Breaking changes
No breaking changes
Same-origin requirement
This route must be served from the same host and port as your Flutter web application. The redirect page uses
window.postMessageand browsers enforce thatpostMessageis only delivered when the receiving window has the same origin (scheme + host + port).example
Server
Frontent
When NOT to use
If your Flutter web app is hosted separately.
In that case, place the
auth.htmlfile provided by (flutter_web_auth_2 README)[https://pub.dev/packages/flutter_web_auth_2#web] in your Flutter app'sweb/directory and use its URL as theredirectUri.