Epic Stack OAuth 2.0 example
This demonstrates how to add an OAuth 2.0 provider to your Epic Stack
application. It uses GitHub, but the changes would be very similar for any other
OAuth 2.0 provider with a
remix-auth strategy.
The easiest way to review the changes is to look at the commits. Here are the highlights:
- Install
remix-auth-githuband setup a GitHub app as documented inremix-auth-github - Add environment variables for the GitHub app's client ID and client secret
- Add the
GitHubStrategyto the available strategies for your authenticator. - Add a button to login with GitHub to the login page. It should post to
/auth/github. - If no user exists for the GitHub email, set the onboardingEmail and redirect the user to onboarding. Otherwise, do the same thing you do when a user signs in with a password.
- Add an action on a route to handle the
/auth/githubthat callsauthenticatewith theGitHubStrategy. - Add a loader on a route for the
/auth/github/callbackGitHub callback. It should callauthenticatewith theGitHubStrategyagain. Do the same thing to handle 2FA that we do for verifying password login.