matrix-react-sdk
Version:
SDK for matrix.org using React
33 lines (32 loc) • 1.49 kB
TypeScript
import { QueryDict } from "matrix-js-sdk/src/utils";
import { OidcClientConfig } from "matrix-js-sdk/src/matrix";
import { IdTokenClaims } from "oidc-client-ts";
/**
* Start OIDC authorization code flow
* Generates auth params, stores them in session storage and
* Navigates to configured authorization endpoint
* @param delegatedAuthConfig from discovery
* @param clientId this client's id as registered with configured issuer
* @param homeserverUrl target homeserver
* @param identityServerUrl OPTIONAL target identity server
* @returns Promise that resolves after we have navigated to auth endpoint
*/
export declare const startOidcLogin: (delegatedAuthConfig: OidcClientConfig, clientId: string, homeserverUrl: string, identityServerUrl?: string, isRegistration?: boolean) => Promise<void>;
type CompleteOidcLoginResponse = {
homeserverUrl: string;
identityServerUrl?: string;
accessToken: string;
refreshToken?: string;
idToken: string;
clientId: string;
issuer: string;
idTokenClaims: IdTokenClaims;
};
/**
* Attempt to complete authorization code flow to get an access token
* @param queryParams the query-parameters extracted from the real query-string of the starting URI.
* @returns Promise that resolves with a CompleteOidcLoginResponse when login was successful
* @throws When we failed to get a valid access token
*/
export declare const completeOidcLogin: (queryParams: QueryDict) => Promise<CompleteOidcLoginResponse>;
export {};