Google Login
Nextfast comes with pre configured google login can be found in auth.config.ts
.
Make sure you have setup the .env
correctly with
# http://localhost:3000 for local development
NEXT_PUBLIC_APP_URL="http://localhost:3000"
# run `npx auth secret` or go to https://generate-secret.now.sh/32
AUTH_SECRET=y+u8yfKbffzeOOuobao1/B0FgsblDOwpsL2y0XTzt7x=
GOOGLE_CLIENT_ID=<your_client_id></your_client_id>
GOOGLE_CLIENT_SECRET=<your_client_secret>
Steps to generate Google Client & Secret
-
Create a new project on Google Cloud
-
In the Google Cloud Console, navigate to the "APIs & Services" > "Library" section.
-
Search for the API you want to enable (e.g., Google Drive API, Gmail API).
-
Click on the API you want to use.
-
Click the "Enable" button.
-
In the Google Cloud Console, navigate to the "APIs & Services" > "OAuth consent screen" section.
-
Choose whether your application is internal or external.
-
Fill in the required fields like "Application Name" and "Authorized domains".
-
Optionally, you can add scopes and additional information.
-
Click "Save and Continue".
-
In the Google Cloud Console, navigate to the "APIs & Services" > "Credentials" section.
-
Click on the "Create Credentials" dropdown and select "OAuth client ID".
-
Choose the application type (Web application) for our use case.
-
Enter a name for your OAuth client ID.
-
Add http://localhost:3000/api/auth/callback/google and https://your-site.com/api/auth/callback/google to Authorized redirect URIs
-
Copy paste the Client ID in
GOOGLE_CLIENT_ID
and Client Secret inGOOGLE_CLIENT_SECRET
to .env.