Skip to content

Latest commit

History

History
49 lines (37 loc) 路 1.85 KB

how-to-setup-oauthclient.md

File metadata and controls

49 lines (37 loc) 路 1.85 KB

gas logo

How to setup a a custom Google OAuth2 client for gas, from A to Z

[1] Creating a Google Cloud project

[2] Setup Oauth consent screen

  • Go to the 'Oauth consent screen'-tab
  • Fill in a 'Product name shown to users' (e.g 'Gas')

All other fields are optional. (https://raw.githubusercontent.com/MaartenDesnouck/google-apps-script/master/images/logo/gas-logo.png, might be a good 'Product logo URL')
  • Click 'Save'

[3] Create API credentials

  • Go to the 'Credentials'-tab
  • Click 'Create credentials'
  • Click 'OAuth client ID'

  • Pick 'Web application'
  • Fill in a 'Name' for the set of credentials you are creating (e.g. gas-credentials-v1)
  • Add 'http://localhost' to the 'Authorized JavaScript origins'
  • Add 'http://localhost' to the 'Authorized redirect URIs'
  • Click 'Create'

You will get a pop-up with some keys, don't close this pop-up but go to step [4]

[4] Configuring gas to use your credentials

  • Go to your terminal
  • Run 'gas config'
  • Answer the question if you want to use .gs as default extension ('n' will keep the default extension)
  • Answer 'y' to the question if you want to use a custom OAuth 2.0 client
  • Paste the client ID from the pop-up
  • Paste the 'client secret' from the pop-up
    You should see 'Succesfully configured gas [鉁擼'
  • Run 'gas auth'
  • You should be redirected to approve your new credentials to make API requests to your Google Drive