Consumer Authentication

/

Mobile SDKs

/

React Native SDK reference

/

OAuth

/

Start

Start

The oauth.google.start() method attempts to complete an OAuth flow using Google Credential Manager on Android. If it fails, it falls back to redirecting the browser to Stytch's oauth google start endpoint. If you prefer to only use a redirect-based OAuth flow, you can use the oauth.google.startWithRedirect() method.

The oauth.apple.start() method attempts to complete an OAuth flow using Sign in with Apple on iOS. If it fails, it falls back to redirecting the browser to Stytch's oauth apple start endpoint. If you prefer to only use a redirect-based OAuth flow, you can use the oauth.apple.startWithRedirect() method.

For other providers, the oauth.$provider.start() methods start OAuth flows by redirecting the browser to one of Stytch's oauth start endpoints. The method will also generate a PKCE code_verifier and store it in local storage on the device (See the PKCE OAuth guide for details). If your application is configured to use a custom subdomain with Stytch, it will be used automatically.

  • oauth.amazon.start()
  • oauth.apple.start()
  • oauth.bitbucket.start()
  • oauth.coinbase.start()
  • oauth.discord.start()
  • oauth.facebook.start()
  • oauth.github.start()
  • oauth.gitlab.start()
  • oauth.google.start()
  • oauth.linkedin.start()
  • oauth.microsoft.start()
  • oauth.salesforce.start()
  • oauth.slack.start()
  • oauth.twitch.start()
  • oauth.yahoo.start()

Method parameters


Configurationobject

Additional configuration.

login_redirect_urlstring
signup_redirect_urlstring
custom_scopesstring
session_duration_minutesint
onCompleteCallback(NativeOAuthAuthenticateResponse) => void
import { useStytch } from '@stytch/react-native';
import { Text, TouchableOpacity, View } from 'react-native';

export const OAuthStart = () => {
  const stytch = useStytch();

  const loginWithGoogle = () => {
    stytch.oauth.google.start({
      login_redirect_url: 'https://example.com/authenticate',
      signup_redirect_url: 'https://example.com/authenticate',
    });
  };

  return (
    <View>
      <TouchableOpacity onPress={loginWithGoogle}>
        <Text>Login with Google</Text>
      </TouchableOpacity>
    </View>
  );
};