Use Google as an authentication strategy for your users
Enabling Google as an authentication provider, means that your users can authenticate to your app via their Google Accounts.
Where I Can Configure It?
- If you haven't, setup your account first
- Go to your environment Config sections
- In the left sidebar, choose Social Identifiers.
- Choose the Google section
Using Shared Credentials
Shared credentials only available in Development Environment
You can test things out quickly by using shared Google OAuth credentials managed by CakeAuth. This way, you can use Google OAuth credentials without setting up your Google Developer credentials.
Setting up Custom Credentials
Get Google Custom Credentials
To use your own Google OAuth credentials:
- Navigate to Google Cloud PLatform console
- From the projects list, select a project or create a new one.
- If the APIs & services page isn't already open, open the console left side menu and select APIs & services.
- On the left, click Credentials.
- Click New Credentials, then select OAuth client ID.
- Select the appropriate application type for your project (in this case, select Web application).
- In the Authorized JavaScript origins setting, select Add URI and add your domain (e.g.,
https://your-domain.com
).- For local development, add
http://localhost:PORT
(replacePORT
with the port number of your local development server).
- For local development, add
- In the Authorized Redirect URIs setting,
- (Recommended) Paste the Default Redirect URI value you get from the CakeAuth Dashboard
- Or if you want to manage your own OAuth callback, paste the redirect URI link for the callback
Managing your own OAuth callback means you also need to verify and issue a token manually yourself.
-
If this is your first time creating a client ID, you can also configure your consent screen by clicking Consent Screen (the following procedure explains how to set up the Consent screen). You won't be prompted to configure the consent screen after you do it the first time.
-
Click Create client ID
Set up Custom Credentials
- After creating your Google OAuth credentials, you should have the Client ID & and Client Secret.
- Go to the Config > Social Identifiers > Google
- Set the values in the Custom Credentials section in the CakeAuth dashboard.
Last updated on