Difference between revisions of "Device flow usecase 1"
Pavel.lobko (talk | contribs) |
Pavel.lobko (talk | contribs) |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:Google drive API}} | {{DISPLAYTITLE:Google drive API}} | ||
+ | The usecase shows the process of creating "i2rest.doc" file on "i2restexample" user Google Drive using I2Rest Client request with Oauth2 Authorization code flow. | ||
Lets walk step by step through our example with creating "i2rest.doc" file on "i2restexample" user 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]). | + | :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 | | + | :b) [[Create_*SYSTEM_Certificate_Store| Create *SYSTEM Certificate Store]] and [[Add_external_CA_to_trust_list |add Google.com SSL CA ]].<br> |
+ | :c) Choose appropriate API method and scope on [https://developers.google.com/drive/api/v3/reference/files/create Google Drive Api page]. | ||
+ | == i2Rest Client command composing == | ||
− | |||
− | |||
<pre> | <pre> | ||
I2REST COMMAND(*POST) | I2REST COMMAND(*POST) |
Revision as of 15:43, 3 June 2020
The usecase shows the process of creating "i2rest.doc" file on "i2restexample" user Google Drive using I2Rest Client request with Oauth2 Authorization code flow. Lets walk step by step through our example with creating "i2rest.doc" file 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) Create *SYSTEM Certificate Store and add Google.com SSL CA .
- c) Choose appropriate API method and scope on Google Drive Api page.
i2Rest Client command composing
I2REST COMMAND(*POST) URL('https://www.googleapis.com/drive/v3/files') BODY(*N '{"name":"i2rest.doc"}' 'application/json' *YES 1208) OUTPUT(*BOTH) DCMCLIENT(MYCLIENT) RECVLOG('/home/btpl/recv.log') SENTLOG('/home/btpl/sent.log') TOKENS('/qsys.lib/qtemp.lib/tokens.usrspc') AUTHID('677815701888-dfa6i6tcrvqpvmc1acii98ij32h7lc3j .apps.googleusercontent.com') AUTHPW('2Rstk_A-u4rbLcm6OFcclMz5') AUTHURL('https://oauth2.googleapis.com/device/code') TOKENURL('https://oauth2.googleapis.com/token') SCOPE('https://www.googleapis.com/auth/drive.file')
- 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.
- As you can see, Authorization Token was obtain, and servers responded with Status 200 to our POST request.