OthentKMS connect() function
The connect()
function helps users connect with Arweave-based applications using traditional login methods like Google. Once connected, users can perform further interactions with the application using their connected account.
To use the connect()
function, import it from the @othent/kms
package and call it within an asynchronous function as follows:
import { connect } from "@othent/kms";
const handleConnect = async () => {
const res = await connect();
console.log(res);
};
Calling the connect()
function launches a pop-up window offering users familiar authentication options.
When connect()
successfully executes, it returns an object as follows:
{
authSystem: "KMS",
email: "[email protected]",
email_verified: true,
family_name: "LastName",
given_name: "FirstName",
locale: "en",
name: "FirstName LastName",
nickname: "fl",
owner: "xIKaD7dtD6mypbMjlquh4NkBujfT8HCiSHd3H1md6cWHg0pFqspVYWJZMrYYZav3zN-MdSgz-9FMXCZW9OD0l1t5zLNUSSKmLMb1hplKPI9ws6rZpJFORFumQPKBppca_f0tlz-mqYfK136ssK8Vn_7byu9SI8G6PY0rN_HCxkGl2T9fzLa2OMi0jerCGzTO-VXR3-ic5TdsWYFAjX18fzQaM3qQii3EUTeQuwtHi_9TIbGFSbfvSQDEx9FsEpn09VJhmMkAKc-E-WUTQ9DaVMUt8xOc6w21FQgkfRgBGDQz9SyGK6z0nIlfq-N5bfab81cDBphgowEv-cX62T1HPsdcCwaWAonM21dzw6IIa24shA4x3Y0yt4_cTZ6Pwi2Z_bBIZp506nEf7vQhuz5o0yGeouWt-mkz6Qci3krzF3tKiGDAaQjLzKDi3Yhmy6korcZThQHSR6NbD5tVE5qU2llbFWHWwowBHDNNzwo8RfPg-dISh_PMlKzKT1F3TXazq9SBGfSjJ8XCw6b305gO_yCMJ7LBCe6zaOljufVwdqhgTzmW62Nr6HLsDCYQx8Xw7To-du2RH0ZgHktBa53G4F6pc1DknQSvgkRK-7Eybxo6y8AgrC2bOIfuSh6_3XetgDE6vxIwXbMwLTeyjKfuDAs9VLwUZRWSF5TeLJB78k8",
picture: "<https://lh3.googleusercontent.com/a/ACg8ocKG2_h6o8_fYe-T7o1DOP_CaaGjpun3yHAht2MF15IF=s96-c>",
sub: "google-oauth2|116310037005724250724",
walletAddress: "DUMI1f8xahdOebdoUu0-v2yGY4EjUayLEidGZnwYVDs",
}
The object contains the following authentication information and user details:
authSystem
: The authentication protocol used.email
: The connected user’s email address.email_verified
: This field is set to true
when the user successfully verifies their email address by clicking a verification link sent to their email.family_name
: The last name or surname associated with the connected user.given_name
: The first name associated with the connected user.locale
: The connected user’s language preferences.name
: The full name of the connected user created by the concatenation of the given_name
and family_name
.nickname
: A less formal or preferred name for the connected user.owner
: Every user account has an associated Arweave wallet. This is the public key of the associated Arweave wallet.