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://localhostreturn 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.
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 randomstate, 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:
redirect_uri with code, state and iss:
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.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 thataud is your client ID, and check that nonce matches the one you stored.
- Node SDK
- HTTP
Install the SDK:
sub as the person’s stable ID in your app. Create your own session for them, and you are done.
Next steps
- Ask for the person’s role and app permissions with the
rolesscope. See Tokens and claims. - Building a single-page app instead? See Single-page apps.
- Sign people out of Aiveth from your app. See Logout.
- See every endpoint and parameter in OpenID Connect endpoints.