Skip to main content

Overview

SSO (Single Sign-On) module for managing SSO authentication. This module provides methods for retrieving SSO tokens for users. These tokens allow you to authenticate Base44 users with external systems or services. This module is only available to use with a client in service role authentication mode, which means it can only be used in backend environments.

Methods

getAccessToken()

getAccessToken(userid): Promise<SsoAccessTokenResponse>
Gets an SSO access token for the user who made the current request. Use this token to authenticate the user with external systems or services. This only works for that same user. Create the client with createClientFromRequest so it acts on behalf of the request’s user, then pass that user’s ID as userid. If userid is any other user, the call fails. An expired token is refreshed automatically when a refresh token is available.

Parameters

string
obbligatorio
The ID of the user who made the current request, such as the id returned by base44.auth.me().

Returns

SsoAccessTokenResponse Response from SSO access token endpoint.
string
obbligatorio

Example


getIdToken()

getIdToken(userid): Promise<string>
Gets the stored SSO OIDC ID token for the user who made the current request. This only works for that same user, not for arbitrary users. Create the client with createClientFromRequest so it acts on behalf of the request’s user, then pass that user’s ID as userid. If userid is any other user, the call fails. The stored token is returned as-is and is never refreshed, so the call fails if the token has already expired.

Parameters

string
obbligatorio
The ID of the user who made the current request, such as the id returned by base44.auth.me().

Returns

Promise<string> Promise resolving to the raw ID-token string.

Example