> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getmocha.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Built‑in auth with Google: add sign‑in and protect pages and actions

Mocha includes a built‑in authentication module. Today it supports Google sign‑in via our Mocha provider. You can enable auth simply by asking the AI to add it.

<Tip>
  Ask: “Add authentication and a sign‑in button.” The AI will set up sign‑in/out flows and guard protected pages and actions.
</Tip>

<AccordionGroup>
  <Accordion title="Do I need my own Google API keys?">
    No. Mocha's provider handles the Google OAuth flow. Just ask the AI to enable authentication.
  </Accordion>

  <Accordion title="Can I add other providers?">
    Not yet. Multiple providers and scopes are on our roadmap. For now, Google is supported out of the box.
  </Accordion>

  <Accordion title="Can I add email/password or username/password authentication?">
    Email/password and username/password authentication are not directly supported yet. While Mocha can sometimes build custom auth flows, it often makes mistakes with security-critical code. We strongly recommend sticking with Google authentication—it's a solid, secure mechanism that works reliably. We plan to add native email/password support soon.
  </Accordion>

  <Accordion title="Can I use my own Google OAuth credentials?">
    Yes, if you're on a Silver or Gold plan. By default, users see "Mocha" in the Google sign-in screen. With your own credentials, they'll see your app's name and logo instead. Learn more in [Customize Google Sign In](/basics/custom-oauth-clients).
  </Accordion>
</AccordionGroup>

***

## More Authentication Questions

<AccordionGroup>
  <Accordion title="Why is Google the only login option?">
    Google authentication is currently the only officially supported option because:

    * **It's secure** - Google handles the security-critical parts like password storage and two-factor auth
    * **It's reliable** - Fewer things can go wrong compared to custom auth systems
    * **It's familiar** - Most users already have a Google account

    We're working on adding more authentication options, including email/password, in the future.
  </Accordion>

  <Accordion title="Can I add phone number authentication?">
    Phone number authentication isn't currently supported as a built-in feature. While you could potentially ask the AI to build something custom using a service like Twilio, we don't officially support this and can't guarantee it will work correctly.

    For now, we recommend using Google authentication for the most reliable experience.
  </Accordion>

  <Accordion title="Can my users log in with their email without Google?">
    Currently, Google is the supported authentication method. Users need a Google account to log in to apps that use Mocha's built-in auth.

    We're planning to add email/password authentication as an option in the future, which would allow users to sign up with any email address.
  </Accordion>

  <Accordion title="Login works in preview but not after publishing">
    If login works in your preview but not on your published app, see our [troubleshooting login guide](/guides/troubleshooting-login). This is usually related to third-party cookie settings in the browser.

    <Note>
      The preview environment is different from your published app. Login issues in preview due to cookies don't affect your published app.
    </Note>
  </Accordion>
</AccordionGroup>
