Skip to main content

Google

In this guide, you will learn how to enable Google authentication and onboard dApp users.

Prerequisites

Steps

Note that some steps are performed using Google Console, and others using Arcana Dashboard. After that simply integrate your dApp with the Arcana Auth SDK to trigger Google login and onboard users.

Step 1: Setup Google OAuth

  • Go to the Arcana Dashboard:

    https://dashboard.beta.arcana.network

    tip

    If you have already registered your dApp using Arcana Dashboard and obtained an App Address, you may skip this step.

  • Register your dApp by creating a new dApp. Specify a dApp name, and select Storage Region as per dApp requirements.

  • You can 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 tab in the dashboard and copy the redirect URI value displayed there. This will be used in the next step to generate Google Client ID.

    redirect_page

  • Do not close the dashboard browser tab. Open another tab and continue with the next step. Then come back to the Dashboard tab and complete Google Client ID settings.

Step 2: Configure Google Cloud Console

  • Go to the Google Cloud Console. Create a new OAuth 2.0 credential for your dApp.

    google_console_redirect

  • In the Google Cloud Console, select the option to set up 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.

    Redirect URI

    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

  • Save the Client ID assigned by Google. It will be required in the next step.

Step 3: Add Google Client ID

  • Revisit the Arcana Dashboard Auth configuration tab in your browser. Refer to the "Google" field and paste the Client ID assigned by Google Cloud Console in the previous step.

    howto_google_auth_type

  • Save the settings on the dashboard. Arcana Network assigns an App Address to every registered and configured dApp. If you plan to integrate with Arcana SDKs, you need to save this App Address.

    howto_app_id

tip

The App Address is displayed on the top right of your dashboard.

You can revisit the Arcana Dashboard later to view and modify configuration settings.

Step 4: Integrate and Use Arcana Auth SDK

  • Use instructions here to integrate with Arcana Auth SDK

  • Trigger Google login to onboard users:

    const providerName = 'google'
    await auth.loginWithSocial(providerName})
  • Check if a user is logged in:

    const connected = await auth.isLoggedIn()

  • Use other Auth SDK functions in your dApp. See Auth SDK Usage Guide for details.

  • Log out an authenticated user:

    await auth.logout()

That is all! 🎉

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

What's Next?

After enabling user sign-in via Google, you can further integrate your dApp with Arcana Storage SDK. This will allow your application to store, retrieve or share files across users. All the Arcana Store data access operations require file owners to sign blockchain transactions using a wallet provider.

Use the Ethereum provider exposed by the embedded Arcana wallet offered by the Auth SDK and enable dApp users to sign blockchain transactions for data access securely.

See also