Sign in with Google

Your visitors sign in with the Google account they already have, and your Authava bot knows who they are. You set it up once. After that, each visitor clicks one button, and returning visitors are signed in again automatically.

Because the bot knows who is asking, it can do things for that person: save a request under their name, and show them their own requests when they come back. Other visitors never see them.

This page plays the website of Dottie's Typewriter Shop, a made-up shop, so you can try it with your own Google account.

Try It

  1. Sign in once, here. Use the Google button above. The chat uses this sign-in, so it never asks you to sign in again.
  2. Ask a general question. Open the chat (bottom right) and tap Help, or ask anything, such as Do you repair typewriters? Dottie answers from the shop's own content. This works without signing in.
  3. Create a repair request. Tap Create request. Dottie saves it under your sign-in and replies with a ticket number. To say what's wrong, type it after a colon, for example: Create request: 1961 Olympia, sticky keys.
  4. See your requests. Tap My requests. Dottie lists the requests saved under your sign-in, each with View and Delete buttons. Delete asks you to confirm first.
  5. Come back later. Sign out, close the browser, then come back and sign in again. Your requests are still there. Sign in with another Google account and you see only that account's requests.

Signed out, Dottie still answers general questions. Ask her to create or list requests and she asks you to sign in first. Dottie's Typewriter Shop is a demo shop, and its repair requests are demo data that we may clear.

How It Works

StepWhoWhat happens
1Site owner (one time)Creates a Google Client ID on Google's Clients page (type Web application), and adds the site's address under Authorized JavaScript origins. Then sends it to their Authava team, who connect it to the bot. The exact steps are in Set It Up Once.
2Your visitorClicks "Sign in with Google" on your page, then picks their account. No password typed on your site, and nothing to set up.
3Your pageReceives Google's sign-in and hands it to the chat with one line: chat.setAuthToken(token).
4AuthavaChecks the sign-in with Google (Google's signature, your Client ID, not expired, verified email). Then the bot knows the visitor's name and email, and can greet them and answer for them.

When the bot calls your own systems, such as a webhook that saves a repair request, the call includes the visitor Authava checked: their Authava user id, email and name. Your system uses that to save and look up that person's own records. It never relies on an email the visitor types into the chat.

Set It Up Once

The site owner does this once, for the whole site. Visitors never do any of it. It is free on Google's side.

  1. Set up your site with Google. Go to Google's Clients page, console.cloud.google.com/auth/clients, and sign in with the Google account that should own the setup. If Google asks you to pick or create a project, do that. The first time, Google also asks you to set up its sign-in screen: click Get started, enter your app name (visitors see it when they sign in) and a support email, choose External so anyone with a Google account can sign in, and finish. You can change the name and logo later on the Branding page.
  2. Create the Client ID. On the Clients page, click Create client and choose Web application as the type. Under Authorized JavaScript origins, click Add URI and enter your site's address, for example https://www.example.com (no path and no trailing slash). Click Create, then copy the Client ID. It ends in .apps.googleusercontent.com. Google's own guide walks through the same steps: Get your Google API client ID. Your Client IDs are also listed on the Credentials page in Google Cloud, where you can add more origins later.
  3. Send the Client ID to your Authava team. They connect it to your bot and turn on sign-in. Tell them whether guests can still chat without signing in (the usual choice), or whether every chat needs sign-in.
  4. Add the page code below to your site, with your bot id and Client ID.

Page Code

<!-- 1. Google's sign-in, and the Authava chat -->
<script src="https://accounts.google.com/gsi/client" async></script>
<script defer src="https://cdn.authava.com/chatbot.js" data-id="YOUR_BOT_ID"></script>

<!-- 2. Where Google's button goes -->
<div id="google-button"></div>

<script>
  let chat = null;
  let googleToken = '';

  // 3. Hand the sign-in to the chat. An empty token signs the visitor out of the chat.
  async function tellChat(token) {
    googleToken = token;
    if (!chat) return;
    chat.setAuthToken(token);
    await chat.refetchSettings();
  }
  window.addEventListener('AuthavaChatbotReady', (event) => {
    chat = event.detail.client;
    if (googleToken) tellChat(googleToken);
  });

  window.addEventListener('load', () => {
    google.accounts.id.initialize({
      client_id: 'YOUR_CLIENT_ID.apps.googleusercontent.com',
      auto_select: true, // returning visitors are signed in again without a click
      callback: (response) => tellChat(response.credential),
    });
    google.accounts.id.renderButton(document.getElementById('google-button'),
      { theme: 'outline', size: 'large', text: 'signin_with' });
    google.accounts.id.prompt();
  });

  // 4. Your sign-out button
  function signOut() {
    google.accounts.id.disableAutoSelect();
    tellChat('');
  }
</script>

Quick Answers

Do my visitors need to set anything up?

No. They only need a Google account, such as Gmail. The Client ID is made once, by the site owner.

What does Authava receive?

The visitor's name, email address and Google account id, after Google has checked them. Never their password, and no access to their Gmail, Drive or anything else in their Google account.

Can visitors still chat without signing in?

Yes. They chat as a guest, as before. Anything tied to their own account, such as their repair requests, waits until they sign in. To require sign-in for every chat, ask your Authava team.

Can visitors see each other's requests?

No. Each request is saved under the visitor Authava checked with Google, and a visitor only ever sees the requests saved under their own sign-in.

Can I let only my own staff sign in?

Yes. Ask your Authava team to limit sign-in to your company's Google Workspace domain. Without a limit, anyone with a Google account can sign in.

How long does a sign-in last?

Google's sign-in lasts about an hour. With auto_select on, returning visitors are signed in again when they come back, without a click.

Does this change bots that don't use it?

No. A bot without Google sign-in turned on works exactly as before.