MultiPaaS

App identities and sign-in

Two kinds of caller use your application's API. End users sign in through your app. App identities are your app's own identity, for background jobs. Both end up with an access token that the API accepts.

End-user sign-in

Your app's end users sign in to MultiPaaS through an OAuth client that you register for the application. The sign-in is the standard authorization-code flow with PKCE.

Your app sends the user's browser to MultiPaaS to sign in. The user approves, and picks the app-tenant they are signing in to, from the environment your app asked for. MultiPaaS sends the browser back to your app with a code. Your app exchanges the code for an access token.

An OAuth client has no secret. You register one to 10 redirect URLs, which must use https. Local development may use http on localhost. A test environment can accept callback URLs of its own on top of these, and they work only when the sign-in names that environment.

Tokens

An access token is valid for 1 hour. A refresh token gets a new one. Each refresh returns a new pair, and a refresh token works once. Using one a second time ends the whole sign-in. The one exception is a refresh whose answer never arrived: retry it with the same refresh token within 60 seconds.

A sign-in lasts at most 7 days. After that, the user signs in again.

Your app's own identity

A background job has no user to sign in. Give it an app identity instead. An app identity is your application's own identity for background jobs. It has a client ID and a secret, and it signs in with the OAuth client credentials grant.

An identity can hold more than one secret, and you can revoke a secret on its own. Tokens already issued with a revoked secret keep working until they expire. You can delete an identity, and its tokens stop working at once.

An app identity belongs to one environment, the one it was created in, and so do the role grants it holds. A job asks for a token for one app-tenant of that environment. It receives one only if it holds a role at that app-tenant, or an application-wide role in the environment. An app-tenant in another environment is refused. A job with an application-wide role in its environment can get an app-wide token instead. That token works on app-wide records only, and sees no app-tenant's records. It works only in the identity's environment.

A job's token lasts 1 hour and comes with no refresh token. When it expires, the job asks for a new one.

An app identity's token works only on the generated API, on records as its roles allow and the me query. It can't manage app-tenants, their members, roles, OAuth clients, app identities or the model, and the multipaas CLI and the web app don't accept it. Run background jobs walks through the setup.

Permissions

Managing app identities needs the permission to manage the application's sign-in, held in the environment the identity belongs to, which is the environment picked in the web app. Registering, changing or deleting an OAuth client, which every environment shares, needs that permission from a role granted in every environment; roles granted in each environment one by one don't count. Only someone who manages the application's access can grant it.

Your own sign-in to MultiPaaS, as a builder, is separate. It never goes into the app you build.