Skip to content
GuidesToolkitAPI

Authenticator

const Authenticator: ForwardRefExoticComponent<AuthenticatorProps & RefAttributes<AuthenticatorHandle>>

Defined in: packages/expo-arcgis-toolkit/src/Authenticator.tsx:188

The ArcGIS Toolkit’s authenticator. While it is mounted, it handles the app’s authentication challenges and shows the Toolkit’s prompts:

  • a username and password, for token-secured services and IWA servers;
  • the portal’s sign-in page in a browser, for a portal in oAuthUserConfigurations;
  • the IAP sign-in, for a host in iapConfigurations;
  • whether to trust a host whose certificate isn’t trusted;
  • which client certificate to use.

Mount one, at the root of the app. It shows nothing until a challenge comes.

It takes the place of expo-arcgis’s challenge handlers, and hands the challenges back when it unmounts. While it is mounted, a login stored with setTokenCredential and setAllowUntrustedHosts don’t apply, unless the setAs…ChallengeHandler props leave those challenges to them. Credentials added with signInWithOAuth, setAppCredential or setServiceCredential keep working.

To keep sign-ins across launches, call expo-arcgis’s enablePersistentCredentialStore() at startup. On Android, OAuth and IAP sign-ins need their redirect URLs in the config plugin’s oAuthRedirectUris.

<MapSettings config={{ apiKey }}>
<Stack />
<Authenticator
oAuthUserConfigurations={[
{ portalUrl: 'https://www.arcgis.com', clientId: '<client id>', redirectUrl: 'my-app://auth' },
]}
/>
</MapSettings>