Skip to content

Authenticating Users via Social Auth

This guide assumes you have already followed the Setup Guide and have a basic understanding of how to use the Signer in your project.

Create a Signer Instance

import { RNAlchemySigner } from "@account-kit/react-native-signer";
 
export const signer = RNAlchemySigner({
  client: { connection: { apiKey: "API_KEY" } },
  // optional param to override session settings
  sessionConfig: {
    // sets the expiration to 60 minutes
    expirationTimeMs: 1000 * 60 * 60,
  },
});

Authenticate a User

To authenticate a user via social auth, use the signer.authenticate() method with the type set to OAuth, the redirectUrl set to your app's deep link, the mode set to redirect and the authProviderId set to the social auth provider you want to use.

Here is an example, authenticating a user via Google:

example.ts
import { signer } from "./signer";
 
signer
  .authenticate({
    type: "OAuth",
    redirectUrl: "com.example.app://oauth",
    mode: "redirect",
    authProviderId: "google",
  })
  .catch((error) => {
    console.error(error);
  });