Skip to content

getAuthDetails

getAuthDetails returns the details about the authenticated user, in accordance with the Web3AuthSigner web SDK's specifications.

This method must be called after authenticate. Otherwise, this method will throw an error with the message Not Authenticated.

Usage

ts
import { createWeb3AuthSigner } from "./web3auth";

const web3AuthSigner = await createWeb3AuthSigner();

const details = await web3AuthSigner.getAuthDetails();
ts
import { Web3AuthSigner } from "@alchemy/aa-signers/web3auth";

export const createWeb3AuthSigner = async () => {
  const web3AuthSigner = new Web3AuthSigner({
    clientId: "test",
    chainConfig: {
      chainNamespace: "eip155",
    },
  });

  await web3AuthSigner.authenticate({
    init: async () => {
      await web3AuthSigner.inner.initModal();
    },
    connect: async () => {
      await web3AuthSigner.inner.connect();
    },
  });

  return web3AuthSigner;
};

Returns

Promise<Web3AuthUserInfo>

A Promise containing the Web3AuthUserInfo, an object with the following fields:

  • verifier: string -- details of the verifier (verifier type, i.e. torus, metamask, openlogin etc.).
  • verifierId: string -- id of the verifier.
  • typeOfLogin: LOGIN_PROVIDER_TYPE -- the type of login done by the user (like google, facebook, twitter, github, etc.).
  • email: string -- [optional] the decentralized ID of the user.
  • name: string -- [optional] the name of the authenticated user.
  • profileImage: string -- [optional] the profile image of the connected user
  • aggregateVerifier: string -- [optional] the details of the aggregate verifier.
  • dappShare: string -- [optional] if you are using a Custom Verifier, you can get a dapp share after successful login to replace device share.
  • idToken: string -- [optional] the id of the token issued by Web3Auth.
  • oAuthIdToken: string -- [optional] the id of the token issued by the OAuth provider.
  • oAuthAccessToken: string -- [optional] the access token issued by the OAuth provider.
  • isMfaEnabled: boolean -- [optional] whether or not multi-factor authentication is enabled for the user.
  • touchIDPreference: string -- [optional]
  • isMfaEnabled: boolean -- [optional] whether or not multi-factor authentication is enabled for the user.