Salesforce

OAuth 2.0 Authorization (Magic xpi 4.9)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

OAuth 2.0 Authorization (Magic xpi 4.9)

The OAuth 2.0 Authorization dialog box opens when you click the OAuth 2.0 button in the Google Resource Setting window. This dialog box contains the following properties:

Property

Description

Client Secret File

Click and select the client_secret .json file that you obtained from the Google Developers Console (see Configuring the OAuth 2.0 Authorization Flow section below).

Authorization URL

A copyable read-only field containing the authorization URL that was obtained when you clicked the Get Auth URL button (below).

Code

Paste the code that you received from Google into this field.

The OAuth 2.0 Authorization dialog box has the following buttons:

Button

Description

AuthURL

Obtains the authorization URL. This button is enabled only when the Client Secret File field (above) has been defined.

Launch

Launches the authorization URL in an external browser. This button is enabled only when the Authorization URL field (above) is populated.

Since version:

4.1

Configuring the OAuth 2.0 Authorization Flow

Each request sent to Google must be identified with an appropriate API. Therefore, you must enable the APIs on the Magic xpi side (the client side) as well as on the Google side (the server side).

  1. In the Settings dialog box's Resources section, create a new Google resource. Click the APIs button to open the APIs list, select at least one API from the list, and then click OK.

  2. Then, create your client ID by performing the following steps in the Google Developers Console:

    1. Go to the Google Developers Console (https://console.developers.google.com/) and log in with your Calendar user credentials.

    2. Create a new project. For this example, you can call it magic xpi.

    3. Under the project that you have just created, click at the top left to expand the Navigation Menu.

    4. In the sidebar, APIs & Services.

    5. In the Popular APIs and services screen, click VIEW ALL and locate the G Suite section.

  1. In the G Suite section, click either Google Drive API or Google Calendar API, depending on which API you are using.

  1. Then, click Enable.

  1. In the sidebar on the left, click Credentials. At the top of the Credentials screen, click the OAuth consent screen tab.

    1. In the Application name parameter, enter a name. This name will appear on the consent page. In the Support email parameter, select your email. The other fields are optional.

    2. Click Save.

    3. Next, you need to create a client ID. If the Credentials tab did not open automatically when you clicked Save (above), you should click Credentials in the sidebar on the left.

    4. In the Credentials screen's Credentials tab, select OAuth client ID from the Create credentials drop-down list.

    1. In the Create OAuth client ID screen's Application type section, select Other, and enter the required name.

    1. Click Create to create your client ID.

    1. Once you have created the client ID, click OK.

    2. Then, click the Download JSON button to save the newly created .json file on your machine.

  1. Next, perform the following steps in Magic xpi:

    1. In the Google resource that you created earlier, click the OAuth button to open the OAuth 2.0 Authorization dialog box.

    2. In the OAuth 2.0 Authorization dialog box, select the .json file that you downloaded from the Google Developers Console.

    1. Click the Auth URL button. A value will appear in the Authorization URL parameter.

    1. Either click the OAuth 2.0 Authorization dialog box's Launch button to open the URL in your default browser, or copy the URL from the Authorization URL parameter to the browser of your choice.

    1. If you are logged into your Google account, you will then be redirected to a consent page. If you are not already logged in, you need to enter your login details to get to the consent page. This page displays the application name that you defined previously in the Google Developers Console.

    2. Click the Allow button to give permission to access your Google Calendar and/or Google Drive.

    1. You will then be redirected to a page containing a code. Copy this code and return to the Magic xpi Google resource.

    1. Paste the code in the OAuth 2.0 Authorization dialog box's Code parameter and click OK.

    1. If no error is received at this point, the OAuth 2.0 Authorization dialog box will close. If an error occurs, click here for information about how to resolve it.

    2. Click the Google resource's Validate button to verify that the process was successful.

Reference
Attachment 
Attachment