Skip to main content
This guide adds a “Login with Aiveth” button to a web app that has its own server. You register the app in the Aiveth console, send people to Aiveth to sign in, exchange the code you get back for tokens, and read who signed in. Aiveth uses the OpenID Connect authorization code flow. PKCE (with S256) is required for every app, including apps that have a secret.

Before you start

  • You can open the Aiveth console and you have the power to manage apps (the Apps page is in your menu).
  • While you build, use your Development environment. It allows http://localhost return addresses. A production app accepts https addresses only.

1. Register the app

1

Open Apps

In the console, open Apps and select Register app.
2

Describe the app

Enter a Name. Under Kind, choose Server app (a web app with its own server that keeps a secret).
3

Add a return address

Under Return addresses, add the address Aiveth sends people back to, one per line. For example http://localhost:3000/callback. Aiveth only returns to these exact addresses.
4

Save the credentials

Select Register app. Copy the Client ID and Client secret, then select I’ve saved them. The secret is not shown again.
The same screen shows the Token address and the Discovery address. The discovery document at https://accounts.aiveth.com/.well-known/openid-configuration lists every endpoint, so most libraries need only that address.

2. Send the person to Aiveth

Make a random state, a random nonce, and a PKCE code_verifier (43 to 128 characters). Keep all three in the person’s session on your server. Then redirect the browser to the authorization endpoint:
The person signs in on Aiveth’s page, if they have not already. Aiveth then redirects to your redirect_uri with code, state and iss:
Check that state matches the one you stored before you use the code. If something went wrong, the redirect carries error and error_description instead.

3. Exchange the code for tokens

From your server, post the code to the token endpoint within two minutes. A code works once.
A successful answer looks like this:
You also get a refresh_token when you asked for the offline_access scope. See Tokens and claims.

4. Read who signed in

The ID token is a JWT signed with RS256. Verify it against Aiveth’s published keys, check that aud is your client ID, and check that nonce matches the one you stored.
Install the SDK:
Use sub as the person’s stable ID in your app. Create your own session for them, and you are done.

Next steps