Registration
This will perform dynamic client registration on the given provider.
If the provider supports dynamic client registration, it will generate a clientId for you to use in subsequent calls to this library.
import { register } from 'react-native-app-auth';
const registerConfig = {
issuer: '<YOUR_ISSUER_URL>',
redirectUrls: ['<YOUR_REDIRECT_URL>', '<YOUR_OTHER_REDIRECT_URL>'],
};
const registerResult = await register(registerConfig);
registerConfig
- issuer - (
string) same as in authorization config - serviceConfiguration - (
object) same as in authorization config - redirectUrls - (
array<string>) REQUIRED specifies all of the redirect urls that your client will use for authentication - responseTypes - (
array<string>) an array that specifies which OAuth 2.0 response types your client will use. The default value is['code'] - grantTypes - (
array<string>) an array that specifies which OAuth 2.0 grant types your client will use. The default value is['authorization_code'] - subjectType - (
string) requests a specific subject type for your client - tokenEndpointAuthMethod (
string) specifies whichclientAuthMethodyour client will use for authentication. The default value is'client_secret_basic' - additionalParameters - (
object) additional parameters that will be passed in the registration request. Must be string values! E.g. settingadditionalParameters: { hello: 'world', foo: 'bar' }would addhello=world&foo=barto the authorization request. - dangerouslyAllowInsecureHttpRequests - (
boolean) ANDROID same as in authorization config - customHeaders - (
object) ANDROID same as in authorization config - connectionTimeoutSeconds - (
number) configure the request timeout interval in seconds. This must be a positive number. The default values are 60 seconds on iOS and 15 seconds on Android.
registerResult
This is the result from the auth server
- clientId - (
string) the assigned client id - clientIdIssuedAt - (
string) OPTIONAL date string of when the client id was issued - clientSecret - (
string) OPTIONAL the assigned client secret - clientSecretExpiresAt - (
string) date string of when the client secret expires, which will be provided ifclientSecretis provided. Ifnew Date(clientSecretExpiresAt).getTime() === 0, then the secret never expires - registrationClientUri - (
string) OPTIONAL uri that can be used to perform subsequent operations on the registration - registrationAccessToken - (
string) token that can be used at the endpoint given byregistrationClientUrito perform subsequent operations on the registration. Will be provided ifregistrationClientUriis provided