Register a user with FormidableLabs/react-native-app-auth
-
Is there a way to register a user using FormidableLabs/react-native-app-auth?
-
So, to call the user registration form, one just needs to:
- Remove any calls to prefetchConfiguration()
- Pass every needed URL (authorize, token and logout endpoints) to a serviceConfiguration object
- Call the authorize() method but use the custom /oauth2/register endpoint
Here's a sample code:
// Configuring FusionAuth const fusionAuthConfig = { issuer: "your.fusionauth.url", clientId: "Your application's Client Id", redirectUrl: "com.your.app://oauthredirect", scopes: ["openid", "offline_access"], serviceConfiguration: { authorizationEndpoint: "https://your.fusionauth.url/oauth2/authorize", userRegisterEndpoint: "https://your.fusionauth.url/oauth2/register", // This will be used down below tokenEndpoint: "https://your.fusionauth.url/oauth2/token", endSessionEndpoint: "https://your.fusionauth.url/oauth2/logout", }, }; // And then, in your component, replace the URL in authorizationEndpoint // with the one in userRegisterEndpoint and call authorize() const config = {...fusionAuthConfig, ...{ serviceConfiguration: { ...fusionAuthConfig.serviceConfiguration, authorizationEndpoint: fusionAuthConfig.serviceConfiguration.userRegisterEndpoint, }, }}; const authState = await authorize(config);
More detail can be found here: https://github.com/FusionAuth/fusionauth-issues/issues/2435
-