Integration​ > r​ mp > google​ >​

_Google oAuth 2.0 configuration & Calendar APIs basic example

oAuth 2.0 with Google Calendar APIs basic example

CONTENTS 1 oAuth 2.0 mechanism 2 Get oAuth 2.0 Credentials 2.1 Get the authorization_code 2.2 Connect to Google Developers Console 2.3 Create a new project in Google Console 2.4 Enable Google Calendar API 2.5 Generate client id & secret 2.6 Get authorization_code 3 Configure the RunMyProcess connectors 3.1 Generate the refresh_token 3.2 Renew access_token 3.3 Call the Google Calendar APIs 4 Configure the RunMyProcess process/CAPI

oAuth 2.0 mechanism

You will create an application (RunMyProcess based) that will try to access Google resources, on behalf of a Google user. There are 5 steps: A.  RunMyProcess sends a client_id & client_secret & scope to Google servers, that will ask the user his consent B.  If user gives his consent, Google servers return an authorization_code. The authorization_code is valid until the user revokes it (on Google side) C.  RunMyProcess will send this authorization_code to Google servers…. D.  ...that will return an access_token  and refresh_token. The refresh_token may be used to  obtain a new access_token. E.  RunMyProcess uses access_token to access a specific resource under the scope provided in (A)  A & B will be done manually by the user, once only (he’ll have to do it again he revokes the access).

Get oAuth 2.0 Credentials

1. Get the authorization_code Go to RunMyProcess, create a Project and a Webinterface to receive the authorization code:

Let’s call this webinterface url redirect_uri note: the text input variable is code

2. Connect to Google Developers Console https://console.developers.google.com/

3. Create a new project in Google Console

Enter a project name & project id then ‘Create’

4. Enable Google Calendar API

Click on ‘Enable an API’:

Search for ‘calendar’ then click on ‘OFF’ in front of ‘Calendar API’

Tick ‘I have read and agree to Calendar API Terms of Service.’ and click on ‘Accept’:

You should now see ‘Google Calendar API’ in Enabled APIs:

5. Generate client id & secret Go to APIs & auth > Credentials. Then Click on ‘Create new Client ID’

Select ‘Web Application’ then ‘Configure consent screen’: 

Select an email address and enter ‘RunMyProcess’ as product name. Then click on save:

Enter https://live.runmyprocess.com as Authorized JS origins, enter redirects_uri (see 1)) as authorized redirects uri, then click on ‘Create Client ID/Update’:

You should now see the Client ID and Secret top right: (refresh page if you don’t see it)

6. Get authorization_code Let’s build the url to retrieve the authorization_code to then request access to google calendar apis:

https://accounts.google.com/o/oauth2/auth? scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar&state=security_token%123&redirect_uri=https%3A%2F%2Flive.runmyprocess.com%2Flive% Here’s a link to url decode/encode string online : http://meyerweb.com/eric/tools/dencoder/ Do use your own security_token/client_secret, redirect_uri and client_id in the url above. Then open this url in your browser. You’ll be asked to login into google, then you’ll see:

Select Accept. You’ll be then redirected to your RunMyProcess webinterface with the authorization_code passed in the url:

This is your authorization_code.

Configure the RunMyProcess connectors Let’s focus on this part:

Every time you’ll want to call Google APIs, you’ll need to pass an access_token. You need to make sure this access_token is still valid. If it has expired,  then you need to renew it using the refresh_token. Let’s create the provider + connector to return an access_token:

1. Generate the refresh_token Create a new provider: Select authentication scheme = none

Under this provider create a new connector:

Title : Get refresh_token POST on o/oauth2/token Content: code=${authorization_code?url}&redirect_uri=${"https://live.runmyprocess.com/live/123/appli/150519?P_mode=TEST"? url}&client_id=${"123.apps.googleusercontent.com"?url}&scope=${"https://www.googleapis.com/auth/calendar"? url}&client_secret=${"Y123Bo72nz"?url}&grant_type=authorization_code Replace in the above content: redirect_uri, client_id, client_secret parameters. When you call this connector passing your authorization_code, you’ll get  as output:

{   "access_token" : "ya29.yQ123lpR5oKlA",   "token_type" : "Bearer",   "expires_in" : 3600,   "refresh_token" : "1/28B2346n8" } The refresh_token will not expire until you revoke it. The access_token will expire, and you’ll need the refresh_token to renew it.

2. Renew access_token Under the same provider ‘Google oauth2 auth:none’, create a new connector:

Title: get access_token from refresh_token POST on o/oauth2/token Content: client_id=${"87123.apps.googleusercontent.com"?url}&client_secret=${"1234A2nz"? url}&grant_type=refresh_token&refresh_token=${"1/281231zAcbWP6n8"?url} Replace in the content above: client_id, client_secret, refresh_token. This connector should give you as output param: {   "access_token" : "ya29.yQDalWy123­Q",   "token_type" : "Bearer",   "expires_in" : 3600 }

3. Call the Google Calendar APIs Create a new provider “Google APIs auth:Bearer” Authentication scheme : Custom Scheme name : Bearer Credentials ${access_token}

Under this provider, configure the connector that will retrieve all the events from a specific calendar:

GET on calendar/v3/calendars/ntriballier@runmyprocess­prem.com/events Replace the string in blue by your own calendar_id

=> as output ${P_result.items} will give you all the events in this calendar More information on Google Calendar APIs > https://developers.google.com/google­apps/calendar/v3/reference/calendarList/get

Configure the RunMyProcess process/CAPI You have to plug the 2 previous connectors to your process/CAPI :

Congratulations! you’ve performed a Google Calendar Integration with RunMyProcess using oauth2 authentication scheme.

oAuth 2.0 with Google Calendar APIs basic example -

You will create an application (RunMyProcess based) that will try to access Google resources, on behalf of a Google ... Connect to Google Developers Console.

580KB Sizes 19 Downloads 160 Views

Recommend Documents

oAuth 2.0 with Google Calendar APIs basic example -
Developers Console. 2.3 Create a new project in. Google Console. 2.4 Enable Google Calendar API. 2.5 Generate client id & secret. 2.6 Get authorization_code.

oAuth 2.0 with Google Calendar APIs basic example - PDFKUL.COM
Google Console. 2.4 Enable Google Calendar API. 2.5 Generate client id & secret. 2.6 Get authorization_code. 3 Configure the RunMyProcess connectors. 3.1 Generate the refresh_token. 3.2 Renew access_token. 3.3 Call the Google Calendar APIs. 4 Configu

Calendar 19-20.pdf
26 27 28 29 30 24 25 26 27 28 29 30 28 29 30. 31. School Holidays Start & End Dates End of Trimester. Sept. 2 - Labor Day Aug. 15 - School Start Nov. 1 Feb. 20. Nov. 11 - Veteran's Day Jun. 4 - School End Jun. 5. Nov. 25-29 - Thanksgiving Break Staff

Describing Web APIs' Social Parameters with RESTdesc
reason to choose a specific ontology or vocabulary to de- scribe the quality of a Web API. This is an important benefit, since we are not bound to a restricted set ...

2017-18 Academic Calendar, 07-20-17.pdf
Sign in. Loading… Page 1. Whoops! There was a problem loading more pages. Retrying... 2017-18 Academic Calendar, 07-20-17.pdf. 2017-18 Academic ...

PDA trial calendar - 7-20-16.pdf
HONORABLE: DATE: HEARING LOCATION: PATRICK DeALMEIDA, P.J.T.C.. 07/20/2016. Trenton, 08625 ... Bhailal H Patel. Jeffrey D Gordon Esq. Docket : Block : Unit : Lot : Type/JL : L, DA. 004053-2015 .... David M Serlin Esq. TR juyeng. Page 3 of 33. Main me

2015-2016 CALENDAR ( REVISED 5-20-15).pdf
... to Board : TJimenez (Revised 5/20/15) Originally Approved: ___2/14/14______. M T W TH F M T W TH F M T W TH F M T W TH F M T W TH F M T W TH F.

Staff Calendar 3-20-17 (1).pdf
Page 1 of 1. Staff Calendar 3-20-17 (1).pdf. Staff Calendar 3-20-17 (1).pdf. Open. Extract. Open with. Sign In. Main menu. Displaying Staff Calendar 3-20-17 ...

2019-20 BOE Approved Calendar Eng&Span.pdf
7. "#$# "#$#. #$. $. "#$# "#$#. %$!$. "#$# "#$#. &'(+.*(. &('. 6 !(389(. *. *01.12:3. 4. 4. Page 2 of 2. 2019-20 BOE Approved Calendar Eng&Span.pdf. 2019-20 BOE Approved Calendar Eng&Span.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying

Calendar 16-17 5-20-16.pdf
May 20, 2016 - Download. Connect more apps... Try one of the apps below to open or edit this item. Calendar 16-17 5-20-16.pdf. Calendar 16-17 5-20-16.pdf.

pto calendar 20`16-17.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. pto calendar ...

pto calendar 20`16-17.pdf
Sign in. Loading… Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying.

pdf-1282\professional-web-apis-with-php-ebay-google-paypal ...
... apps below to open or edit this item. pdf-1282\professional-web-apis-with-php-ebay-google- ... l-amazon-fedex-plus-web-feeds-by-paul-reinheimer.pdf.