authenticate
authenticate
is a method on the Web3AuthSigner
which leverages the web3auth
web modal SDK to authenticate a user.
You must call this method before accessing the other methods available on the Web3AuthSigner
, such as signing messages or typed data or accessing user details.
Usage
ts
import { Web3AuthSigner } from "@alchemy/aa-signers/web3auth";
const web3AuthSigner = new Web3AuthSigner({
clientId: "test",
chainConfig: {
chainNamespace: "eip155",
},
});
await web3AuthSigner.authenticate({
init: async () => {
await web3AuthSigner.inner.initModal();
},
connect: async () => {
await web3AuthSigner.inner.connect();
},
});
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 useraggregateVerifier: 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.
Parameters
authParams: <Web3AuthAuthenticationParams>
An object with the following fields:
init: () => Promise<void>
-- a method you can define as necessary to leverage theweb3auth
SDK for authentication. For instance, in the example above,authenticate
uses theinitModal
method.connect: () => Promise<void>
-- a method you can define as necessary to leverage theweb3auth
SDK for authentication. For instance, in the example above,authenticate
uses theconnect
method.