ReactNativeContainer
@authgear/react-native / ReactNativeContainer
Class: ReactNativeContainer
ReactNativeContainer is the entrypoint of the SDK. An instance of a container allows the user to authenticate, reauthenticate, etc.
Every container has a name.
The default name of a container is default
.
If your app supports multi login sessions, you can use multiple containers with different names.
You are responsible for managing the list of names in this case.
Table of contents
Constructors
Properties
Accessors
Methods
- authenticate
- authenticateAnonymously
- authenticateBiometric
- canReauthenticate
- changePassword
- checkBiometricSupported
- configure
- disableBiometric
- enableBiometric
- fetch
- fetchUserInfo
- getAuthTime
- getIDTokenHint
- isBiometricEnabled
- logout
- open
- promoteAnonymousUser
- reauthenticate
- refreshAccessTokenIfNeeded
- refreshIDToken
- wechatAuthCallback
Constructors
constructor
• new ReactNativeContainer(options?
)
Parameters
Name | Type |
---|---|
options? | ContainerOptions |
Defined in
packages/authgear-react-native/index.d.ts:691
Properties
delegate
• Optional
delegate: ReactNativeContainerDelegate
Defined in
packages/authgear-react-native/index.d.ts:655
Accessors
accessToken
• get
accessToken(): undefined
| string
Returns
undefined
| string
Defined in
packages/authgear-react-native/index.d.ts:689
• set
accessToken(accessToken
): void
Parameters
Name | Type |
---|---|
accessToken | undefined | string |
Returns
void
Defined in
packages/authgear-react-native/index.d.ts:690
clientID
• get
clientID(): undefined
| string
OIDC client ID
Returns
undefined
| string
Defined in
packages/authgear-react-native/index.d.ts:670
• set
clientID(clientID
): void
Parameters
Name | Type |
---|---|
clientID | undefined | string |
Returns
void
Defined in
packages/authgear-react-native/index.d.ts:671
isSSOEnabled
• get
isSSOEnabled(): boolean
Is SSO enabled
Returns
boolean
Defined in
packages/authgear-react-native/index.d.ts:677
• set
isSSOEnabled(isSSOEnabled
): void
Parameters
Name | Type |
---|---|
isSSOEnabled | boolean |
Returns
void
Defined in
packages/authgear-react-native/index.d.ts:678
name
• get
name(): string
Unique ID for this container.
Default Value
"default"
Returns
string
Defined in
packages/authgear-react-native/index.d.ts:663
• set
name(name
): void
Parameters
Name | Type |
---|---|
name | string |
Returns
void
Defined in
packages/authgear-react-native/index.d.ts:664
sessionState
• get
sessionState(): SessionState
Returns
Defined in
packages/authgear-react-native/index.d.ts:683
• set
sessionState(sessionState
): void
Parameters
Name | Type |
---|---|
sessionState | SessionState |
Returns
void
Defined in
packages/authgear-react-native/index.d.ts:684
Methods
authenticate
▸ authenticate(options
): Promise
<AuthenticateResult
>
Authenticate the end user via the web.
Parameters
Name | Type |
---|---|
options | AuthenticateOptions |
Returns
Promise
<AuthenticateResult
>
Defined in
packages/authgear-react-native/index.d.ts:738
authenticateAnonymously
▸ authenticateAnonymously(): Promise
<AuthenticateResult
>
Authenticate as an anonymous user.
Returns
Promise
<AuthenticateResult
>
Defined in
packages/authgear-react-native/index.d.ts:767
authenticateBiometric
▸ authenticateBiometric(options
): Promise
<AuthenticateResult
>
Parameters
Name | Type |
---|---|
options | BiometricOptions |
Returns
Promise
<AuthenticateResult
>
Defined in
packages/authgear-react-native/index.d.ts:809
canReauthenticate
▸ canReauthenticate(): boolean
canReauthenticate() reports whether the current user can reauthenticate. The information comes from the ID token and the ID token is NOT verified.
Returns
boolean
Defined in
packages/authgear-react-native/index.d.ts:704
changePassword
▸ changePassword(options
): Promise
<void
>
Parameters
Name | Type |
---|---|
options | SettingsActionOptions |
Returns
Promise
<void
>
Defined in
packages/authgear-react-native/index.d.ts:742
checkBiometricSupported
▸ checkBiometricSupported(options
): Promise
<void
>
Check whether biometric is supported on the current device. If biometric is not supported, then a platform specific error is thrown.
Parameters
Name | Type |
---|---|
options | BiometricOptions |
Returns
Promise
<void
>
Defined in
packages/authgear-react-native/index.d.ts:802
configure
▸ configure(options
): Promise
<void
>
configure() configures the container with the client ID and the endpoint. It also does local IO to retrieve the refresh token. It only obtains the refresh token locally and no network call will be triggered. So the session state maybe outdated for some reason, e.g. user session is revoked. fetchUserInfo should be called to obtain the latest user session state.
configure() can be called more than once if it failed. Otherwise, it is NOT recommended to call it more than once.
Parameters
Name | Type |
---|---|
options | ConfigureOptions |
Returns
Promise
<void
>
Defined in
packages/authgear-react-native/index.d.ts:732
disableBiometric
▸ disableBiometric(): Promise
<void
>
Returns
Promise
<void
>
Defined in
packages/authgear-react-native/index.d.ts:807
enableBiometric
▸ enableBiometric(options
): Promise
<void
>
Parameters
Name | Type |
---|---|
options | BiometricOptions |
Returns
Promise
<void
>
Defined in
packages/authgear-react-native/index.d.ts:808
fetch
▸ fetch(input
, init?
): Promise
<Response
>
Fetch function for you to call your application server. The fetch function will include Authorization header in your application request, and handle refresh access token automatically.
Parameters
Name | Type |
---|---|
input | RequestInfo |
init? | RequestInit |
Returns
Promise
<Response
>
Defined in
packages/authgear-react-native/index.d.ts:789
fetchUserInfo
▸ fetchUserInfo(): Promise
<UserInfo
>
Fetch user info.
Returns
Promise
<UserInfo
>
Defined in
packages/authgear-react-native/index.d.ts:777
getAuthTime
▸ getAuthTime(): undefined
| Date
getAuthTime() reports the last time the user was authenticated. The information comes from the ID token and the ID token is NOT verified.
Returns
undefined
| Date
Defined in
packages/authgear-react-native/index.d.ts:711
getIDTokenHint
▸ getIDTokenHint(): undefined
| string
getIDTokenHint() returns the ID token for the OIDC id_token_hint parameter.
Returns
undefined
| string
Defined in
packages/authgear-react-native/index.d.ts:697
isBiometricEnabled
▸ isBiometricEnabled(): Promise
<boolean
>
Check whether biometric was enabled for the last logged in user.
Returns
Promise
<boolean
>
Defined in
packages/authgear-react-native/index.d.ts:806
logout
▸ logout(options?
): Promise
<void
>
Logout.
Remarks
If force
parameter is set to true
, all potential errors (e.g. network
error) would be ignored.
Parameters
Name | Type | Description |
---|---|---|
options? | Object | Logout options |
options.force? | boolean | - |
Returns
Promise
<void
>
Defined in
packages/authgear-react-native/index.d.ts:761
open
▸ open(page
, options?
): Promise
<void
>
Parameters
Name | Type |
---|---|
page | Page |
options? | SettingOptions |
Returns
Promise
<void
>
Defined in
packages/authgear-react-native/index.d.ts:751
promoteAnonymousUser
▸ promoteAnonymousUser(options
): Promise
<AuthenticateResult
>
Open promote anonymous user page
Parameters
Name | Type | Description |
---|---|---|
options | PromoteOptions | promote options |
Returns
Promise
<AuthenticateResult
>
Defined in
packages/authgear-react-native/index.d.ts:773
reauthenticate
▸ reauthenticate(options
, biometricOptions?
): Promise
<ReauthenticateResult
>
Reauthenticate the end user via biometric or the web.
If biometricOptions is given, biometric is used when possible.
Parameters
Name | Type |
---|---|
options | ReauthenticateOptions |
biometricOptions? | BiometricOptions |
Returns
Promise
<ReauthenticateResult
>
Defined in
packages/authgear-react-native/index.d.ts:750
refreshAccessTokenIfNeeded
▸ refreshAccessTokenIfNeeded(): Promise
<void
>
Returns
Promise
<void
>
Defined in
packages/authgear-react-native/index.d.ts:781
refreshIDToken
▸ refreshIDToken(): Promise
<void
>
refreshIDToken() asks the server to issue an ID token with latest claims. After refreshing, getIDTokenHint() and canReauthenticate() may return up-to-date value.
Returns
Promise
<void
>
Defined in
packages/authgear-react-native/index.d.ts:718
wechatAuthCallback
▸ wechatAuthCallback(code
, state
): Promise
<void
>
WeChat auth callback function. In WeChat login flow, after returning from the WeChat SDK, this function should be called to complete the authorization.
Parameters
Name | Type | Description |
---|---|---|
code | string | WeChat Authorization code. |
state | string | WeChat Authorization state. |
Returns
Promise
<void
>
Defined in
packages/authgear-react-native/index.d.ts:797