Skip to content

Latest commit

 

History

History
55 lines (35 loc) · 2.79 KB

How to generate Google API keys.md

File metadata and controls

55 lines (35 loc) · 2.79 KB

How to generate Google API keys

cws-publish uses the Chrome Web Store API.

Here's how to get its 3 access keys: clientId, clientSecret, refreshToken

Note: the names you enter here don't really matter.

  1. Visit https://console.developers.google.com/apis/api/chromewebstore/overview

  2. Create a project:

    chrome-apis-create-project
  3. Enter a name (e.g. webstore-yourextensionname)

  4. Visit https://console.developers.google.com/apis/api/chromewebstore/overview again

  5. Enable the API:

    chrome-apis-enable-webstore
  6. Open Credentials > Create credentials > OAuth client ID:

    create-credentials
  7. Click on Configure consent screen:

    configure consent screen
  8. Enter a product name (e.g. yourextensionname) and save

  9. Select Other and click Create

    client type id
  10. Save your ✅ clientId and ✅ clientSecret, these are your keys.

  11. Place your clientId in this URL 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&access_type=offline&redirect_uri=urn:ietf:wg:oauth:2.0:oob
    
  12. Follow its steps and copy the authcode it shows on the last page:

    auth code
  13. Run this in your terminal console.

curl -X POST \
  https://www.googleapis.com/oauth2/v4/token \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Postman-Token: 6e25fe5b-da32-4b69-9985-15fa74463cd6' \
  -d 'client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&code=CODE_AT_PREVIOUS_STEP&grant_type=authorization_code&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob'
  1. Save your ✅ refreshToken:

    access token
  2. Done. Now you should have ✅ clientId, ✅ clientSecret and ✅ refreshToken. You can use these for all your extensions, but don't share them!