feat(auth): Add custom auth support for Google and GitHub providers #826
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.
Setup
The user must first create the necessary GitHub OAuth app and/or Google OAuth Client ID with the redirect URIs set to http://localhost:4280/.auth/login/github and http://localhost:4280/.auth/login/google respectively.
They must then add the "auth" configuration in their staticwebapp.config.json file and set the appropriate environment variables containing client ID and client secret values before running starting the SWA CLI.
GitHub Login
User clicks on "Log in with GitHub" link (http://localhost:4280/.auth/login/github), which redirects to https://github.com/login/oauth/authorize.
User logs into GitHub if not already logged in.
User authorizes GitHub OAuth app if not already authorized for their account.
User is redirected back to the static web app.
Google Login
User clicks on "Log in with Google" link (http://localhost:4280/.auth/login/google), which redirects to https://accounts.google.com/o/oauth2/v2/auth.
User logs into Google if not already logged in.
User authorizes Google OAuth app if not already authorized for their account.
User is redirected back to the static web app.