Skip to content

User Login with AWS Cognito

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 AWS Cognito as the authentication provider.

Prerequisites

Steps

Using AWS Cognito to onboard users in a Web3 app that is integrated with the Arcana Auth SDK is simple!

Just a single line of code!

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 AWS Cognito.

await auth.loginWithSocial('aws')

Check if a user is logged in:

const connected = await auth.isLoggedIn()

After onboarding users, developers can add code to access the other Arcana Auth SDK functions in the app. See Arcana Auth SDK Usage Guide for details.

Add code in the application to log out an authenticated user:

await auth.logout()

That is all!

Your app is all set for authenticating users via AWS Cognito. Authenticated users can instantly access the Arcana wallet to sign blockchain transactions.

Apps using Custom IAM Providers

!!! an-warning "Apps using IAM Providers"

Apps typically integrate with Arcana Auth SDK for user onboarding and blockchain transaction signing. Authentication providers must be configured through the Arcana Developer Dashboard before integrating with the SDK.

Some apps may use third-party IAM providers like AWS Cognito for authentication but still integrate with Arcana Auth SDK for accessing Arcana wallet. Configuration differs as the third-party IAM providers directly support authentication verifiers like Google.

Developers only need to configure the IAM provider via Arcana Developer Dashboard, skipping the configuration of authentication verifiers that integrate directly with the IAM providers. Use the respective IAM provider's console, such as Cognito Developer Console, for setting up authentication verifiers like Google and not the Arcana Developer Dashboard.

No Aggregate Login with Cognito

The aggregate login feature does not work for the third-party IAM providers such as Cognito.

If a user has the same email ID registered with say a social login provider and with Cognito, logging into an app using Cognito will create a new unique user account even if the user uses the same email as the one used with a social login provider or via the passwordless option. What this means is that the wallet address for the same user will be different when Cognito is used to log in and subsequently a social login provider or passwordless login is used by the same user having the same email ID.

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 use this token to verify user login and subsequently generate another token for app use. Learn more about how to verify the Arcana JWT Token for apps deployed on Testnet and Mainnet.

What's Next?

To know more about how to use Web3 wallet operations programmatically in your app, see Arcana wallet Developer's Guide. Refer to the Arcana wallet User's Guide for more information on how authenticated app users can access the wallet UI.

See also


Last update: March 29, 2024 by shaloo, shaloo