Difference between revisions of "Authorization code usecase 1"
Pavel.lobko (talk | contribs) |
Pavel.lobko (talk | contribs) |
||
| Line 4: | Line 4: | ||
;Preparations | ;Preparations | ||
| − | :At the very beginning your application should be registered as a client (obtaining Device ID and Device Password) on [https://console.developers.google.com/apis/credentials Google] (see [https://developers.google.com/identity/protocols/oauth2 details]). | + | :a) At the very beginning your application should be registered as a client (obtaining Device ID and Device Password) on [https://console.developers.google.com/apis/credentials Google] (see [https://developers.google.com/identity/protocols/oauth2 details]). |
| − | :[[Add_external_CA_to_trust_list |Add Google.com SSL certificate CA to your DCM]]. | + | :b) [[Add_external_CA_to_trust_list |Add Google.com SSL certificate CA to your DCM]]. |
| − | :Register your i2Rest Client on your i2Rest Server as a client to enable "bridge mode". | + | :c) Register your i2Rest Client on your i2Rest Server as a client to enable "bridge mode". |
| − | Choose appropriate API method and scope on [https://developers.google.com/drive/api/v3/reference/files/list Google Drive Api page] | + | :d) Choose appropriate API method and scope on [https://developers.google.com/drive/api/v3/reference/files/list Google Drive Api page] |
| − | ; | + | ;Composing i2Rest comand |
| − | : | + | :So what we need is: |
<pre> | <pre> | ||
I2REST COMMAND(*Get) | I2REST COMMAND(*Get) | ||
| − | URL('https://www.googleapis.com/drive/v3/files') | + | URL('https://www.googleapis.com/drive/v3/files') |
| − | + | </pre> <br> | |
| − | DCMCLIENT(MYCLIENT) | + | :to set request method and API endpoint to values we prepared on Preparations step d; |
| + | |||
| + | <pre> | ||
| + | DCMCLIENT(MYCLIENT) | ||
| + | </pre> <br> | ||
| + | |||
AUTHMETHOD(*BRIDGE) | AUTHMETHOD(*BRIDGE) | ||
AUTHID('677815701888-aj80fure8f1laqd3dqvpqtmlandni5an | AUTHID('677815701888-aj80fure8f1laqd3dqvpqtmlandni5an | ||
| Line 23: | Line 28: | ||
') | ') | ||
TOKENURL('https://oauth2.googleapis.com/token') | TOKENURL('https://oauth2.googleapis.com/token') | ||
| − | SCOPE('https://www.googleapis.com/auth/drive.file') | + | SCOPE('https://www.googleapis.com/auth/drive.file') |
| + | <pre> | ||
BRIDGEURL('https://api.i2rest.com:22089/a2d') | BRIDGEURL('https://api.i2rest.com:22089/a2d') | ||
BRIDGEID(OAUTH21) | BRIDGEID(OAUTH21) | ||
Revision as of 13:05, 3 June 2020
Lets walk step by step through our example with getting the list of existing files on "i2restexample" user Google Drive.
- Preparations
- a) At the very beginning your application should be registered as a client (obtaining Device ID and Device Password) on Google (see details).
- b) Add Google.com SSL certificate CA to your DCM.
- c) Register your i2Rest Client on your i2Rest Server as a client to enable "bridge mode".
- d) Choose appropriate API method and scope on Google Drive Api page
- Composing i2Rest comand
- So what we need is:
I2REST COMMAND(*Get)
URL('https://www.googleapis.com/drive/v3/files')
- to set request method and API endpoint to values we prepared on Preparations step d;
DCMCLIENT(MYCLIENT)
AUTHMETHOD(*BRIDGE)
AUTHID('677815701888-aj80fure8f1laqd3dqvpqtmlandni5an
.apps.googleusercontent.com')
AUTHPW(tI2ezmVGioGwrGk9K2O23Mv5)
AUTHURL('https://accounts.google.com/o/oauth2/v2/auth
')
TOKENURL('https://oauth2.googleapis.com/token')
SCOPE('https://www.googleapis.com/auth/drive.file')
BRIDGEURL('https://api.i2rest.com:22089/a2d')
BRIDGEID(OAUTH21)
BRIDGEPW(oauth21)
- Check the result!
- Here is server response:
Server response (status 200, shown 214 bytes of 214):
{
"kind": "drive#fileList",
"incompleteSearch": false,
"files": [
{
"kind": "drive#file",
"id": "1b-aQhiVeXgAQZVYeftIpuBo2GCvKQzHz",
"name": "i2rest.doc",
"mimeType": "application/msword"
}
]
}




