Skip to content

Last updated

To set up Google login, create a Web application OAuth client in Google Cloud, then enter its Client ID and Client Secret in TML Social.

Before You Start

Google shows the Client Secret in full only once, when you create the client. Copy it then. If you lose it, add a new secret to the client.

Google deletes OAuth clients that haven't been used for six months, emailing the project's contacts 30 days before. On a site where nobody logs in with Google for that long, check those emails or the login will stop working.

Register Your App

Open Google Auth Platform in the Google Cloud console, select or create a project, and click "Get started". Enter an app name and a support email, choose "External" for the audience, and enter a contact email. Users see the app name and support email when they log in. See Google's Get started guide.

Under "Audience", click "Publish app". TML only asks Google for a user's basic profile and email address, so Google doesn't require your app to be verified. Without brand verification, Google shows your domain rather than your app name and logo when users log in.

Create the Client

Follow Google's Manage OAuth Clients guide to create a client with an application type of "Web application".

Under "Authorized redirect URIs", add your TML login page URL with the provider appended as a query argument. By default, this is https://yoursite.com/login/?provider=google. If you changed the login page slug, use yours instead of "login". If your site uses plain permalinks, it's https://yoursite.com/?action=login&provider=google. Google requires an exact match, including the query string, and HTTPS. Changes can take from five minutes to a few hours to take effect.

On a multisite network, each site has its own login page, so add a redirect URI for every site that shows the buttons.

Obtain Client ID & Client Secret

When you click "Create", Google shows the Client ID and Client Secret. Copy them into their corresponding fields under Theme My Login → Social. On a multisite network, the settings are in the Network Admin, and one Google client serves every site on the network.

Click "Google" to open its box if it's closed, check "Enable" and then click "Save Changes".

Login With Google

You will now see "Continue with Google" on your login form. The first time someone logs in, they're matched to an existing user with the same email address or, if registration is open, a new user is created for them. Google login requires a verified email address.

If Google shows "redirect_uri_mismatch", the redirect URI in your client doesn't exactly match the one above.