This package requires the following environment variables to be set:
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET
GOOGLE_REFRESH_TOKEN
Below is a step-by-step of how to get the values to correctly fill those variables:
Note: the names you enter below don't really matter, so you can just put whatever you feel comfortable with.
-
Visit the Google API Console.
-
Create new project:
-
Enter a name and click
Create
. This can take some seconds, and Google will notify you when it's done. -
Visit the Google API Console again.
-
Enable the API, clicking on the button
Enable
: -
On the page that opened, search for
Chrome Web Store API
, and enable it. -
Open Credentials > Create credentials > OAuth client ID:
-
Click on Configure consent screen:
-
Enter a product name and save.
-
Select Other and click Create:
-
A new modal opens, with two fields, the first containing a
client ID
, and the second containing aclient secret
. Save those values, as we are going to need them later. -
In the following URL, replace
<YOUR_CLIENT_ID>
with the value of yourclient ID
, and open it:https://accounts.google.com/o/oauth2/auth?client_id=<YOUR_CLIENT_ID>&response_type=code&scope=https://www.googleapis.com/auth/chromewebstore&redirect_uri=urn:ietf:wg:oauth:2.0:oob
-
Follow the steps shown on the screen and, on the last page, you will see another code which is the
auth code
. Save this value, as we will also use it later. -
Run this in your browser's console.
It's just a wizard to create and copy acurl
into your clipboard:var clientId = 'YOUR CLIENT ID HERE' var clientSecret = 'YOUR CLIENT SECRET HERE' var authCode = 'YOUR AUTH CODE HERE' copy( `curl "https://accounts.google.com/o/oauth2/token" -d "client_id=${encodeURIComponent( clientId, )}&client_secret=${encodeURIComponent( clientSecret, )}&code=${encodeURIComponent( authCode, )}&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob"`, ) console.log('The curl has been copied. Paste it into your terminal.')
-
Paste the generated code in your terminal and run it. If your terminal doesn't natively support
curl
, try using thegit bash
terminal instead, or use online curl. You can also manually install curl, if none of options before worked. -
The
curl
command will give you This will give you an object which looks like the following:From this object, the only important information is the
refresh_token
, so it is important to save this value as, you guessed it, we are going to need it later. -
You should have now a
client ID
, aclient secret
, and arefresh_token
. Use them to set the following environment values:GOOGLE_CLIENT_ID
: set the value toclient ID
.GOOGLE_CLIENT_SECRET
: set the value toclient secret
GOOGLE_REFRESH_TOKEN
: set the value torefresh_token
Now you should have all three environment variables correctly set. You can use the same values for all your extensions, but remember not share them publicly, as they will allow anyone to publish your extensions!