Getting started
My Auths signs users in for your application. Your app sends people to My Auths, they sign in there, and your app gets back standard OpenID Connect tokens that say who the user is and which roles they have in your app.
You don't build login forms, store passwords or handle password resets. Every application gets these out of the box:
- Email and password sign-up and sign-in, with email verification and password reset.
- Sign-in with Google and GitHub.
- Two-step verification with an authenticator app, for users who turn it on.
- Protection against password guessing: an email is locked for 15 minutes after 5 wrong passwords.
How it fits together
| Term | What it is |
|---|---|
| Owner | You. You sign in to the dashboard and manage your companies and applications there. |
| Company | A group of your applications. Apps of the same company get the same user ID for a person (see Users and Access). |
| Application | One app that signs users in: an OpenID Connect client with its own client ID, client secret, redirect URLs, roles and members. |
| User | A person with a My Auths account. One account works in every application; each application has its own list of members. |
1. Register your application
- Sign in at dash.myauths.com. The first time, you're asked to open an owner account.
- Create a company. Only the name is required.
- Create an application in that company. The important field is Redirect URL: the address in your app that users come back to after signing in, for example
https://app.example.com/auth/callback. - Copy the Client ID and Client secret shown when the application is created.
Redirect URLs during development
Deployed applications need https redirect URLs on a real domain. While your app runs on your own machine, set the application's Cloud provider to Local: then http://localhost, http://127.0.0.1 and http://[::1] URLs work too. A localhost URL has to match exactly, port included; 127.0.0.1 and [::1] URLs match on any port, for tools that pick a free port each time.
When you deploy, change the cloud provider and use your https URL. Local addresses stop working as soon as the application is no longer Local. You can add more redirect URLs, and the URLs users go to after signing out, on the application's Sign-in tab.
2. Configure your app
Most OpenID Connect libraries configure themselves from the issuer's discovery document, so these values are usually all you need:
| Setting | Value |
|---|---|
| Issuer | https://api.myauths.com |
| Discovery document | https://api.myauths.com/.well-known/openid-configuration |
| Client ID | The application's client ID from the dashboard |
| Client secret | The secret you stored in step 1 |
| Redirect URL | Exactly one of the redirect URLs registered for the application |
| Scopes | openid profile email |
My Auths expects:
- The authorization code flow with PKCE, using the
S256method. PKCE is required for every application. The implicit and password flows aren't supported. - Client authentication with HTTP Basic (
client_secret_basic) on the token endpoint. - A server that keeps the secret. Single-page and mobile apps need a small backend that exchanges the code and holds the tokens.
3. Sign a user in
The whole flow is covered in Sign-in Flow. In short:
- Your app redirects the browser to
https://api.myauths.com/oauth2/authorizewith your client ID, redirect URL, scopes and a PKCE challenge. - The user signs in on the My Auths page, which shows your application's name and logo. The first time your app asks for their profile or email, they're asked to allow it.
- The browser comes back to your redirect URL with a
code. - Your server exchanges the code at
https://api.myauths.com/oauth2/tokenfor an access token, an ID token and a refresh token.
The ID token tells your app who signed in. The access token is what your app sends to your own API, which verifies it.
Before you go live
- The application's cloud provider says where it runs, and every redirect URL is
https. - If your app signs users out, its sign-out URL is registered on the Sign-in tab.
- You chose who can use the app: anyone who signs in, or only people you add (see Users and Access).
- Your API checks each access token's signature, issuer, audience and expiry.
- Your app identifies users by the
subclaim, not by their email.