Please enable JavaScript to view this site.

A-Shell Consolidated Reference

Navigation: Appendix > Libraries > ASHNET

Google Cloud Access Token

Scroll Prev Top Next More

The ability to get a Google Cloud access token was added to the ASHNET library (1.14.184) to support an operation that arises when the owner of an object stored in Google Cloud Storage wants to make it available to an external user. In such a case, instead of requiring the standard browser-based OAUTH2 authentication, the owner can provide a private key, which the recipient can then use to request the an access token directly. Because of the special nature of the operation, it was not exposed as a standard A-Shell XCALL, but may still be called using the generic DYNLIB routine, as follows:

funcsig$ = "GetGoogleCloudAccessToken(Zziz)i"

xcall DYNLIB, dlctl, funcsig$, prvkey$, token$, sizeof(token$), url, rc

Parameters

prvkey$  (String)  [in]

is a json string containing a private key, something like:

{

"type": "service_account",

"project_id": "chilkattest-1350",

"private_key_id": "fa2e36ee26986eab628b59868af8bec1d1c64c38",

"private_key": "-----BEGIN PRIVATE KEY-----\nMII....jSdy\n-----END PRIVATE KEY-----\n",

"client_email": "598922945xxxxxxxxxxxxa@developer.gserviceaccount.com",

"client_id": "5989229452xxxxxxxxxxxxxxxxa.apps.googleusercontent.com",

"auth_uri": "https:!accounts.google.com/o/oauth2/auth",

"token_uri": "https://accounts.google.com/o/oauth2/token",

"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",

"client_x509_cert_url": "https://www.googleapis.com/robot/v1/m...com"

}

 

token$  (String, 2048)  [out]

receives the access token

cb  (Num)  [in]

specifies the size of the token$ parameter

url  (String)  [in]

optional url; default: https://www.googleapis.com/auth/cloud-platform

rc  (I4)  [out]

return code (0 for success, else ANETERR_xxx codes)