Skip to content

User Login with Twitch

Estimated time to read: 2 minutes

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

Prerequisites

Steps

Using Twitch 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 Twitch.

await auth.loginWithSocial('twitch')

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 Twitch.

s??? an-tip "Arcana JWT Token"

=== "`loginToken`"

    Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the [Arcana JWT Token](../../../../../concepts/an-jwt-token.md). App developers can access this token via `getUser()` method and refer to the `loginToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object.

    Developers can use this token to [verify the user](../../../../../concepts/jwt-token-validation.md) 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.

=== "`userDIDToken`"

    Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the [Arcana DID Token](../../../../../concepts/an-jwt-token.md). App developers can access this token via `getUser()` method and refer to the `userDIDToken` field of the [`UserInfo`](https://authsdk-ref-guide.netlify.app/interfaces/userinfo) object.

    Developers can use this token to [verify the user](../../../../../concepts/an-did-token.md#verify-did-token) and subsequently generate another token for app use.

What's Next?

Authenticated users can instantly access the in-app Arcana wallet UI for signing blockchain transactions. Use the AuthProvider EIP-1193 standard Ethereum provider to call JSON/RPC functions and Web3 wallet operations in the app. Learn more...

See also


Last update: April 7, 2024 by shaloo, shaloo