Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Authorization token for Google Cloud Storage

I am trying to integrate Google cloud storage API for transferring all my web app uploads to google cloud storage.

According to documentation, I need to pass Authorization header every time making a new request but am not getting where I can get that Authorization token? I tried so hard I checked a lot of Git repos and StackOverflow discussions.

Still am not able to find answers.

For more informations

enter image description here

like image 295
rohitcoder Avatar asked Apr 18 '18 17:04

rohitcoder


People also ask

How can I get GCP authorization code?

Get the authorization codeGo to the Google Cloud console. On the Registered Domains page, click the domain name that you'd like to transfer out. On the Domain details page, click Authorization code. The code is available on the Authorization code pop-up dialog.

How can I get access token using authorization code?

To get a new access token, use the refresh token as you would an authorization code, but with a grant_type value of refresh_token and a refresh_token parameter that holds the contents of the refresh token. The type of grant being used. To exchange a refresh token for an access token, use refresh_token .


Video Answer


1 Answers

You can get the Authorization token in OAuth 2.0 Playground. Follow the steps described. Notice that in step 2 you have to click on “Exchange authorization code for tokens” to obtain the “Access token” you need. I suggest you to follow this Uploading objects guide (REST APIs) the first time you try it.

Perhaps you can do this using the Cloud Storage Client Libraries.

like image 55
Rubén C. Avatar answered Oct 11 '22 04:10

Rubén C.