User Authentication with Google OAuth 2.0
Esta página aún no está disponible en tu idioma.
LaunchFast uses in house simple as heck server-side first Google OAuth 2.0 to help you authenticate users via Google.
You can configure it in the
src/pages/api/auth/google.ts
and src/pages/api/auth/callback/google.ts
file. You can configure it in the
src/auth.ts
file. - Update the
.env
file or hosting provider’s environment variable to have the necessary variables for Google OAuth 2.0:
# Authentication
## Obtained from Google APIs## https://developers.google.com/identity/protocols/oauth2/web-server#prerequisites## Google OAuth 2.0 Environment VariablesGOOGLE_AUTH_ID="....apps.googleusercontent.com"GOOGLE_AUTH_SECRET="...-...-..."GOOGLE_AUTH_CALLBACK_URL="http://localhost:3000/api/auth/callback/google"
# Authentication
## Obtained from Google APIs## https://developers.google.com/identity/protocols/oauth2/web-server#prerequisites## Google OAuth 2.0 Environment VariablesAUTH_GOOGLE_ID="...apps.googleusercontent.com"AUTH_GOOGLE_SECRET="..."
- To simply authenticate users via Google, import the
Sign-In-With-Google
component in each framework as described below:
---import SignInWithGoogle from '@/components/Auth/Sign-In-With-Google.astro'---
<html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> </head> <body> <SignInWithGoogle /> </body></html>
<script>import SignInWithGoogle from '@/components/Sign-In-With-Google.svelte'</script>
<SignInWithGoogle />