API Maker

The backend engine for the AI era

Auth providersEpisode 25 8:30 13 chapters November 2026

Sign-In for Your Users: DB Token Generator, Custom Tokens and SSO

Your app has people: customers, staff, partners. Auth providers let them sign in and tell every API who is calling, without one line of login code: a DB token generator over your own table with hashed passwords, signed and refreshed tokens, a custom token generator, single sign-on with Google, Azure AD and AWS, and g.req.auth in your code.

In the playlists The complete course Security & access

Chapters

What you will learn

  • Two tokens: the application and the person
  • A password column, hashed
  • A DB token generator and its fields
  • A customer signs in: what is inside the token
  • An API for signed-in customers, checked on every call, and refresh
  • A custom token generator, and single sign-on
  • g.req.auth, the settings of the installation, and best practices
In the docsSingle sign-on
Transcript1151 words · click a time to play from there

Intro

Your app has people: customers, staff, and partners. Auth providers let them sign in. And they tell every API who is calling, without one line of login code.

Login code, again

Every project writes the same login code again. A login endpoint. Password hashing. JSON web tokens, and their refresh. A check that the user is still allowed in. And the same checks, copied into every endpoint. One shortcut, and passwords leak, or tokens never expire. With API Maker, a provider points at your users table. The schema hashes the passwords. Tokens are signed, refreshed, and checked on every call. And an API asks for a signed in person with one setting.

In this video: the Auth Providers page, a DB token generator over the customers in PostgreSQL, a customer who signs in, an API that needs a signed in customer, a custom token generator with your own sign in code, and single sign on.

The page

Auth providers are in the Security panel. The page lists the providers of the account. There are none yet. Add offers five kinds. A DB token generator, for people stored in your own table. A custom token generator, for your own sign in code. And AWS Cognito, Azure AD, and Google, for single sign on.

Two tokens

A request can carry two tokens. The API user token, in x A M authorization, says which application calls. The person token, in x A M user authorization, says who is using it. The groups decide what the application can call. The person decides whose data it is. Single sign on tokens have their own headers: x aws, x google, and x azure authorization.

DB token generator

Calm Home keeps its customers in PostgreSQL. For this video, they get a password column. And the schema of the table hashes it. Every write through API Maker stores a keyed hash, never the password as it was typed. Click Update. There is no hashing library, no salt to manage, and no plain text to leak. Click Add, and pick DB token generator. Its basic info names the table, the username column, the password column, and a condition: only active customers can sign in.

The select decides which columns go into the token. And the token lasts one hour. The fields generator runs every time a token is made or refreshed. It gets the row of the customer. It returns what the app needs, so the app does not make another call: the customer id, the loyalty tier, and a display name. Save it, and customer login is on the list.

Sign in

To sign in, the app calls the Get token system API. In API Testing, pick system APIs, then Get token. The body names the provider, the email, and the password. Send. Kabir gets a token, a refresh token, and how long it lasts: one hour. Let us look inside the token. It has the columns of the select, and a fingerprint of the password, never the password itself. Token data holds what the fields generator returned.

And the installation signs the token, with its issuer and its end time. A wrong password gets no token. Ishaan gets no token either, because his account is blocked. The condition stops him. Both answers say nothing about which part was wrong.

APIs for persons

Now an API that needs a signed in customer. Here is a custom API, My Profile. Its basic info names the provider, under auth providers. Its code reads the customer from g dot req dot auth. Save it. In API Testing, the person header lists the customers of the provider. Pick Kabir, and send. We get the profile of Kabir. Now the same API, called from an app. With only the API user token, it answers four oh one, and asks for the person token.

With the token of Kabir, we get his profile. The person is checked on every call. Now we block Kabir, with an update through API Maker. His token stops working on the very next call. A change made straight in the database is seen within a minute. Tokens are short on purpose. Send the refresh token to the same Get token API, and you get a new pair. This works as long as the person is still allowed in, and the password did not change.

Custom token generator

Some sign ins are not a username and a password. At Calm Home, a guest can follow an order with the email and the order number. A custom token generator has two functions. The token generator checks the email in PostgreSQL and the order in MySQL. Then it signs a token with g dot sys dot system dot hash. The token validator runs on every call. It checks the signature and the end time, and returns the claims, or false.

Save it. Try it from the list. Give an email and an order number, and send. We get a token. The Order Status API asks for this provider. It reads the order id from g dot req dot auth dot auth custom. A fake token gets four oh one, because the validator said no.

Single sign-on

For single sign on, add Google. Its settings are the client id of your Google app, the claim that names the person, and if you want, a table that holds the groups of each person. Save it. On every call, API Maker checks the Google token with the public keys of Google, its audience, and its end time. Azure AD and AWS Cognito work the same way. Always give Google its client id, and Azure its audience.

Without them, a token made for another app would be accepted, and the security report flags the provider. Three kinds of providers, in one list.

g.req.auth

In code, g dot req dot auth holds who is calling. It has the API user, the row of a DB provider, what a token validator returned, and the claims of a single sign on token. It is the same object in every language.

Root settings

The root user owns the settings of every token. From its dashboard, open Deployment Settings, the Security card, and Your APIs. Here you set the secret that signs every token, tokens accepted across admin accounts, how long they last, the refresh, the issuer, and the algorithm.

Best practices

Here are some best practices. Hash passwords in the schema. Put a condition on every provider, so blocking someone is one update. Keep tokens short, and refresh them. Put display data in the token, never secrets. A custom validator must check a signature, not only read the token. And give roles with a groups column. That is the next video.

Recap

That was auth providers. A DB token generator over your own table. Hashed passwords, and tokens that are signed and refreshed. An API that asks for a person, with one setting. Your own sign in code, and single sign on. Next: roles, row ownership, and best practices. API Maker. Build faster. Spend smarter. Deliver better.