In this guide you will learn how to configure your dApp for onboarding users via Discord authentication.
- Make sure you can access Arcana Developer Dashboard:
- Install the
@arcana/authpackage. For details, see Arcana Auth Quick Start Guide.
At a high level, you need to perform these four steps for enabling Discord authentication in your dApp. Some of these actions are performed using Discord Developer Portal, others using Arcana Dashboard. Finally, you need to integrate the Arcana Auth SDK with the dApp and trigger Discord login for dApp users.
Step 1: Choose Login Type: Discord
Go to the Arcana Dashboard:
If you have already registered your dApp using Arcana Dashboard and obtained an appID, you may skip this step.
Register your dApp by creating a new dApp, specifying a name and choosing your preferred
Storage Regionin the dashboard.
You can choose to use defaults for other settings or change them as per your use case. Refer to the how to configure dApp guide for details.
Do not close the dashboard browser tab. Open another tab and setup Discord OAuth. Then revisit the Dashboard tab for completing dApp configuration settings.
Step 2: Use Discord Developer Portal for OAuth Credentials
- Go to the Discord Developer Portal and create a new application to setup OAuth 2.0 credentials for your dApp.
- Save the application in Discord Developer Portal. Discord will assign a unique Application ID and a public key for this new application entry.
- Copy the Application ID and the public key. It will be required in the next step while configuring Discord settings using Arcana Dashboard.
Step 3: Update Discord OAuth Client ID and Secret in the Arcana Dashboard
- In the Arcana Dashboard
Authconfiguration tab, refer to the "Discord" section. Paste the Application ID and public key assigned by Discord, in the previous step as the ClientID and secret respectively, in the Discord configuration input fields.
- Save the settings. Arcana Network assigns an appID to every registered and configured dApp. If you plan to integrate with Arcana Storage SDK, you need to save this appID.
You can revisit Arcana Dashboard later to view and modify configuration settings. The appID is displayed on the top right of your dashboard.
Step 4: Integrate with Arcana Auth SDK and trigger Discord login
Use instructions here to integrate with Arcana Auth SDK
Trigger social login for Discord:
Check if a user is logged in:
const connected = await auth.isLoggedIn()
Log out an authenticated user:
That is all! 🎉
Your dApp is all set for onboarding users via Discord authentication mechanism.
After enabling Discord OAuth based user sign in, you can further integrate your dApp with Arcana Storage SDK. This will allow your application to store, retrieve or share files across users. All file store and access operations require file owners to sign blockchain transactions using a wallet provider.
Use the Arcana wallet Ethereum provider exposed by Auth SDK for enabling dApp users to sign file storage related transactions securely.