Last Updated about an hour ago
Getting a Google Client ID and Client Secret for the SSO module
Sign in with Google: Client ID and Client Secret
The SSO Single Sign-On module lets customers sign in to the shop with their Google account. This requires two keys from the Google Cloud console: Client ID and Client Secret. Below you will find how to get them in the Google console (the Google Auth Platform section) and enter them in the module.Stage 1. Redirect address from the module
After signing in, Google sends the customer back to this address. You need to enter it in the Google console.Step 1. In the back office menu, select PrestaShow Modules > SSO Single Sign-On. The module configuration opens on the Apple tab.
Step 2. Click the Google tab and copy the address from the Redirect URI field. This field cannot be edited, the module fills it in automatically. In this example the address is
https://yourshop.com/module/pshowsso/login. Note. Google only accepts addresses starting with
https://. If the address in the field starts with http://, enable SSL in the shop: Shop Parameters > General, field Enable SSL. Stage 2. Project and app registration in Google
The keys are created in a Google Cloud project, in the Google Auth Platform section. On your first visit, the console asks you to create a project and register the app.Tip. Button and field names in the Google console are given in English. If your Google account uses another language, they may be translated.
Step 1. Open
https://console.developers.google.com/auth/clients and sign in with the Google account that will manage sign-in for the shop. Step 2. If you do not have a project yet, the console asks you to create one. The project name is up to you, in this example
Your Shop. Step 3. If the console asks you to register the app, click Get started and complete the following steps:
- App name - the app name, in this example
Your Shop, - User support email - the email address customers can write to about signing in,
- Audience - select External so that any customer with a Google account can sign in,
- contact information - the email address where Google will send notifications about the project.
Stage 3. Client ID and Client Secret
An OAuth client is the pair of keys you will enter in the module.Step 1. In the Google Auth Platform menu, select Clients and click Create client.
Step 2. In the Application type field, select Web application. In the Name field, enter any name, in this example
Shop sign-in. Step 3. In the Authorized redirect URIs section, click Add URI and paste the address copied from the module in stage 1, without any changes. Leave the Authorized JavaScript origins section empty, the module does not use it.
Step 4. Click Create.
Step 5. In the window with the client details, copy the Client ID and Client Secret or download them as a JSON file. Keep them in a safe place.
Note. The Client Secret is visible only in this window. Once you close it, the console shows only the last 4 characters of the secret. If you did not save it, open the client, add a new secret with the Add Secret button and disable the old one.
Stage 4. Publishing the app
A new app has the test status (Testing). Publish it so that it works in the shop without the limits of test mode.Step 1. In the Google Auth Platform menu, select Audience, click Publish app and confirm. The status changes to In production.
Note. The module asks Google only for the customer's first name, last name and email address, so Google does not require app verification. Without brand verification, customers will see the shop domain on the Google sign-in screen instead of the app name and logo. To show the name and logo, complete the Branding section and click Verify Branding.
Stage 5. Keys in the module
Finally, enter the keys in the module and enable sign-in with Google.Step 1. Go back to the shop back office and open the Google tab in the module configuration (PrestaShow Modules > SSO Single Sign-On).
Step 2. In the Client ID field, paste the client ID from stage 3.
Step 3. In the Client Secret field, paste the client secret from stage 3.
Step 4. (Optional) In the Theme field, select the look of the sign-in button: Light (the default) or Dark.
Step 5. Turn on the Active switch.
Step 6. Click Save. The module saves the settings and shows a message about a successful update. If the Client ID or Client Secret field is empty, the module saves sign-in with Google as disabled.
Step 7. Test signing in: in the box below the form, click the Sign in with Google button. The Google sign-in screen opens in a new tab, and after signing in you return to the shop home page as a signed-in customer.
Important information
- Changes in the Google console take effect after a few minutes, sometimes after a few hours. A
redirect_uri_mismatcherror right after creating the client may only mean a delay. If it does not go away, the address in Google differs from the address in the Redirect URI field in the module. - When you change the shop domain, switch to https, or add or remove
www, the redirect address changes too. Enter the new address in the client in the Google console. - If the console reports that the domain is not authorized, add the shop domain in the Branding section, in the Authorized domains field.
- If the shop already has a customer account with the same email address as the Google account, the module signs the customer in to that account. Otherwise it creates a new customer account.
- The sign-in buttons appear below the customer login form and in the personal information step of the checkout, only for customers who are not signed in.
- Google automatically deletes an OAuth client that has not been used for 6 months. It sends an email 30 days in advance, and a deleted client can be restored within 30 days. This matters if you disable sign-in with Google for a longer time.