@trimble-oss/trimble-id-react
Version:
> **Important Notice:** > > As of version 1.0.0, `PersistentOptions` have been removed. By default, the SDK now supports in-memory token storage. > > When you upgrade to version 1.x, storage options will no longer be available, resulting in a breaking
83 lines (82 loc) • 3.54 kB
TypeScript
import React, { PropsWithChildren } from 'react';
import { TIDClient, AuthState } from '../TIDClient';
export interface TIDProviderProps extends PropsWithChildren {
/**
* The URL for the Trimble Identity OpenID well known configuration endpoint
* Staging: https://stage.id.trimblecloud.com/.well-known/openid-configuration
* Production: https://id.trimble.com/.well-known/openid-configuration
* @type {string}
*/
configurationEndpoint?: string;
/**
* Client id of the application created in trimble developer console
* @type {string}
*/
clientId?: string;
/**
* The URL to which Trimble Identity should redirect after successfully authenticating a user
* @type {string}
*/
redirectUrl?: string;
/**
* The URL to which Trimble Identity should redirect after successfully logout a user
* @type {string}
*/
logoutRedirectUrl?: string;
/**
* The type of credentials you want (openID, or application_name)
* @type {string[]}
*/
scopes?: string[];
/**
* TID client instance. You can send an instance of the TID Client
* if you want to handle the initialization yourself
* @type {TIDClient}
*/
tidClient?: TIDClient;
/**
* When the redirect callback occur this function will be call once the user is login
* using the TIDClient.
* This could allow you to redirect the user into another page after the login happen
* @param {AuthState} authState - Object contain the state returned from TID
* @example Redirect the user into the dashboard page
* <TIDProvider onRedirectCallback={()=>{router.navigate('/dashboard')}}>
*/
onRedirectCallback?: (authState: AuthState) => void;
/**
* When the redirect callback occur if this flag is set to true the TIDProvider will
* check if the redirect url match the current url, if it doesn't match it will not
* authenticate the user.
* If this flag is set to false the TIDProvider will just check if the url contain the
* auth params and will authenticate the user.
* @type {boolean}
*
* @example Flag set to true and the url doesn't match
* <TIDProvider checkRedirectUrlMatch={true}>
* // url: https://localhost:3000/dashboard
* This will not authenticate the user or try to handle the callback
*
* @example Flag set to true and the url match but doesn't contain the auth params
* <TIDProvider checkRedirectUrlMatch={true}>
* // url: https://localhost:3000/dashboard?state=123
* This will not authenticate the user or try to handle the callback
*
* @example Flag set to true and the url match and contain the auth params
* <TIDProvider checkRedirectUrlMatch={true}>
* // url: https://localhost:3000/dashboard?code=123&state=123
* This will authenticate the user and try to handle the callback
*
* @example Flag set to false
* <TIDProvider checkRedirectUrlMatch={false}>
* // url: https://localhost:3000/dashboard
* This will not authenticate the user because the url contain does contain the auth params
*
* @example Flag set to false
* <TIDProvider checkRedirectUrlMatch={false}>
* // url: https://localhost:3000/dashboard?code=123&state=123
* This will authenticate the user and try to handle the callback
*/
checkRedirectUrlMatch?: boolean;
}
declare const TIDProvider: (props: TIDProviderProps) => React.JSX.Element;
export default TIDProvider;