Difference between revisions of "Authorization code usecase 1"
Pavel.lobko (talk | contribs) (Created page with "{{DISPLAYTITLE:Dealing with Google Drive}} ---- Back to i2Rest Client") |
Pavel.lobko (talk | contribs) |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:Dealing with Google Drive}} | {{DISPLAYTITLE:Dealing with Google Drive}} | ||
+ | Lets walk step by step through our example with creating "i2rest.doc" file on "i2restexample" user Google Drive | ||
+ | ;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]). | ||
+ | :[[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" | ||
+ | ;Step 1 | ||
+ | :Execute command | ||
+ | <pre> | ||
+ | I2REST COMMAND(*POST) | ||
+ | URL('https://www.googleapis.com/drive/v3/files') | ||
+ | BODY(*N '{"name":"i2rest.doc"}' | ||
+ | 'application/json' *YES 1208) | ||
+ | OUTPUT(*JOBLOG) | ||
+ | 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) | ||
+ | </pre> | ||
− | + | ;Step 2 | |
+ | :i2Rest Client will provide you with link - go ahead and follow it. | ||
+ | :[[File:Device-flow-usecase1-1.png]] | ||
+ | <br> | ||
+ | :Find yourself on device connection page. Proceed with "Next" button. | ||
+ | :[[File:Device-flow-usecase1-2.png]] | ||
+ | <br> | ||
+ | :Grant access to requested scope. | ||
+ | :[[File:Device-flow-usecase1-3.png]] | ||
+ | <br> | ||
+ | :Here we are! | ||
+ | :[[File:Device-flow-usecase1-4.png]] | ||
+ | <br> | ||
+ | ;Check the result! | ||
+ | :We didn't make a screenshot with i2rest.doc on our example Google Drive, but you can check your own file right now. And some proofs from job log. | ||
Revision as of 16:14, 2 June 2020
Lets walk step by step through our example with creating "i2rest.doc" file on "i2restexample" user Google Drive
- Preparations
- At the very beginning your application should be registered as a client (obtaining Device ID and Device Password) on Google (see details).
- Add Google.com SSL certificate CA to your DCM.
- Register your i2Rest Client on your i2Rest Server as a client to enable "bridge mode"
- Step 1
- Execute command
I2REST COMMAND(*POST) URL('https://www.googleapis.com/drive/v3/files') BODY(*N '{"name":"i2rest.doc"}' 'application/json' *YES 1208) OUTPUT(*JOBLOG) 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)
- Step 2
- i2Rest Client will provide you with link - go ahead and follow it.
- File:Device-flow-usecase1-1.png
- Find yourself on device connection page. Proceed with "Next" button.
- File:Device-flow-usecase1-2.png
- Grant access to requested scope.
- File:Device-flow-usecase1-3.png
- Here we are!
- File:Device-flow-usecase1-4.png
- Check the result!
- We didn't make a screenshot with i2rest.doc on our example Google Drive, but you can check your own file right now. And some proofs from job log.