Skip to main content

Google

In this guide you will learn how to configure your dApp for onboarding users via Google authentication.

Prerequisites​

Basic Steps​

At a high level, you need to perform these four steps for enabling Google authentication in your dApp. Some of these actions are performed using Google Console, others using Arcana Dashboard and finally, you need to integrate the Arcana Auth SDK and trigger Google login for your dApp users.

Step 1: Choose Login Type: Google​

  • Go to the Arcana Dashboard:

    https://dashboard.beta.arcana.network

    tip

    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 Region in 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.

  • Go to the Auth configuration section and copy the redirect URI value displayed there. This will be used in the next step to generate Google OAuth.redirect_page

  • Do not close the dashboard browser tab. Open another tab and setup Google OAuth. Then revisit the Dashboard tab for completing dApp configuration settings.

Step 2: Use Google Cloud Console for OAuth Credentials​

  • Go to the Google Cloud Console and create a new OAuth 2.0 credential for your dApp.google_console_redirect
  • In the Google Cloud Console, select the option to setup credentials for a web application. Google OAuth ClientID create
  • Specify the redirect URI value to the one that you saved in the previous step from the Auth tab of the Arcana Network Dashboard. The redirect URI refers to the endpoint to which the Google OAuth 2.0 server can send authentication responses. These endpoints must adhere to Google’s validation rules.
  • Complete the steps in Google Cloud Console for creating a new OAuth 2.0 credential. It will generate a unique ClientID.Google OAuth ClientID copy
  • Copy and save the Client ID assigned by Google. It will be required in the next step while completing the Arcana dashboard dApp configuration.

Step 3: Update Google OAuth Client ID in the dashboard​

  • Revisit the dashboard Auth configuration tab. Refer to the "Google" field and paste the Client ID assigned by Google, in the previous step, in the input text field. howto_google_auth_type
  • 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. howto_app_id
tip

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 Google login​

  • Use instructions here to integrate with Arcana Auth SDK

  • Trigger social login for Google:

    await auth.requestSocialLogin('google')
  • Check if a user is logged in:

    const connected = await auth.isLoggedIn()
  • Log out an authenticated user:

    await auth.logout()

That is all! πŸŽ‰

Your dApp is all set for onboarding users via Google authentication mechanism.

What's Next?​

After enabling Google 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.

See also​