@criipto/verify-react
Version:
Verify SDK for React Single Page Applications
67 lines (66 loc) • 2.52 kB
TypeScript
import React from 'react';
import { AuthorizeUrlParamsOptional, PKCEPublicPart, Prompt } from '@criipto/auth-js';
import { Action } from './context';
import { ResponseType } from '@criipto/auth-js/dist/types';
export interface CriiptoVerifyProviderOptions {
domain: string;
clientID: string;
/**
* @deprecated Development use only
*/
protocol?: 'https' | 'http';
redirectUri?: string;
children: React.ReactNode;
pkce?: PKCEPublicPart;
state?: string;
nonce?: string;
prompt?: Prompt;
scope?: string;
uiLocales?: string;
loginHint?: string;
/**
* Enables storage and automatic fetch of tokens
* by utilizing browser storage and SSO silent logins.
* Make sure "SSO for OAuth2" is enabled on your Criipto Domain.
* Only works for `response: 'token'` (default)
*/
sessionStore?: Storage;
/**
* Will ammend the login_hint parameter with `action:{action}` which will adjust texsts in certain flows.
* Default: 'login'
*/
action?: Action;
/**
* Will ammend the login_hint parameter with `message:{base64(message)}` which will set a login/aprove message where available (Danish MitID).
*/
message?: string;
/**
* Note: In most cases modifying this setting **is not needed**. Defaults will work with almost all React SPA cases.
* By default @criipto/verify-react will do PKCE on your behalf and return a jwt token.
* However if you wish you can disable this and get the raw `code` response by setting `response` to 'code'.
*/
response?: 'token' | 'code';
completionStrategy?: 'client' | 'openidprovider';
/**
* @deprecated Criipto internal use
*/
criiptoSdk?: null | string;
/**
* @deprecated Criipto internal use
*/
responseType?: ResponseType | 'code id_token';
/**
* @deprecated Criipto internal use
*/
responseMode?: 'query' | 'form_post' | 'fragment' | 'json' | 'post_message';
}
export declare const ACTION_SUPPORTING_ACR_VALUES: string[];
export declare const MESSAGE_SUPPORTING_ACR_VALUES: string[];
export declare function buildLoginHint(loginHint: string | undefined | null, params: {
options?: AuthorizeUrlParamsOptional;
action?: Action;
message?: string;
}): string | undefined;
declare const CriiptoVerifyProvider: (props: CriiptoVerifyProviderOptions) => React.ReactElement;
export default CriiptoVerifyProvider;
export declare function resetRedirectState(window: Window): void;