Sam Dutton
Sam Dutton

Reputation: 15279

Google API Node.js YouTube examples: oauth2.keys.json location and redirect URL

In the Google API Node.js client library examples for YouTube, where should oauth2.keys.json be located?

Also, in that file, what should be the redirect URL — for example, if I just want to run the playlist.js example.

Upvotes: 0

Views: 938

Answers (2)

SteveFromAccounting
SteveFromAccounting

Reputation: 197

The key should be created at google-api-nodejs-client/samples/oauth2.keys.json. Here's a sample format:

{
  "web": {
    "client_id": "blahblah-some-client-id",
    "client_secret": "22retnuh",
    "redirect_uris": [
        "http://localhost:3000/oauth2callback"
    ]
  }
}

Upvotes: 1

Chris Adams
Chris Adams

Reputation: 1454

Following the require statement, it looks they have their key in a file not added to the repo. Makes sense.

I recently wrote a YouTube Jukebox that used api key and oauth key and added it to a private repo and cannot now make it public without exposing those keys or by recreating the repo.

Anyhow, either create your own file and export object or just add you key directly in the you tube const alue. Just depends if you’re going to share what you’ve done.

Upvotes: 1

Related Questions