User Login with Google
Estimated time to read: 1 minute
In this guide, you will learn how a 'Vanilla HTML/CSS/JS' app integrated with the Arcana Auth SDK can easily onboard users via custom login UI and Google as the authentication provider.
Prerequisites
-
Make sure you can access the Arcana Developer Dashboard: https://dashboard.arcana.network
-
Use the Arcana Developer Dashboard to register the app and obtain a unique Client ID required for integrating the app with the Arcana Auth SDK.
-
Carefully follow the instructions to configure Google as the authentication provider.
-
Use the appropriate integration method as per the app type and integrate the app with the Arcana Auth SDK before accessing the user onboarding function of the Arcana Auth SDK.
Steps
Using Google to onboard users in a Web3 app that is integrated with the Arcana Auth SDK is simple!
Just a single line of code!
Step 1: Call loginWithSocial
function
Make sure that all the prerequisites listed above are met. The app should be successfully registered, configured, and integrated with the Arcana Auth SDK, before adding code to onboard users via Google.
await auth.loginWithSocial('google')
Check if a user is logged in:
const connected = await auth.isLoggedIn()
Add code in the app to log out an authenticated user:
await auth.logout()
That is all!
The Web3 app is all set for onboarding users via Google.
Arcana JWT Token
Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the Arcana JWT Token. App developers can access this token via getUser()
method and refer to the loginToken
field of the UserInfo
object.
Developers can use this token to verify the user and subsequently generate another token for app use if required.
In the future, the Arcana JWT Token will be deprecated. Use userDIDToken
to verify user.
Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the Arcana DID Token. App developers can access this token via getUser()
method and refer to the userDIDToken
field of the UserInfo
object.
Developers can use this token to verify the user and subsequently generate another token for app use.
What's Next?
After onboarding app users via Google, you can allow authenticated users to access the Arcana wallet for signing blockchain transactions on any supported blockchain network. Plug in other Arcana Auth SDK functions in the app code such as getting the authenticated user's account details, performing Web3 wallet operations, etc. See Arcana Auth SDK Usage Guide and Arcana wallet Developer's Guide for details.
See also
- Arcana authentication concepts.
- How to integrate with the Arcana Auth SDK
- Handling authentication errors
- Auth Examples