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(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 asuserid):Promise<SsoAccessTokenResponse>
userid. If userid is any other user, the
call fails. An expired token is refreshed automatically when a refresh token
is available.
Parameters
string
必須
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.
Properties
Properties
string
必須
Example
getIdToken()
getIdToken(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 asuserid):Promise<string>
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
必須
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.