cbbeny
cbbeny

Reputation: 21

Youtube API Authentication - multiple scopes

It is posible to authorize youtube API with multiple scopes once? ( https://www.googleapis.com/auth/yt-analytics.readonly and https://www.googleapis.com/auth/youtube.readonly)

Upvotes: 2

Views: 1608

Answers (3)

FabricioG
FabricioG

Reputation: 3320

An example in Python would be:

YOUTUBE_SCOPES = ["https://www.googleapis.com/auth/youtube.upload", "https://www.googleapis.com/auth/youtube.readonly"]

Where you can put any scopes in the array. Then execute:

  flow = flow_from_clientsecrets(CLIENT_SECRETS_FILE,
    scope=YOUTUBE_SCOPES,
    message=MISSING_CLIENT_SECRETS_MESSAGE)

Upvotes: 0

Corey
Corey

Reputation: 1133

Multiple scopes can be given as a space delimited list.

Per the auth flow documentation

 SCOPE      Required. A space-delimited list of scopes that identify the resources that 
 your application could access on the user's behalf. These values determine 
 which permissions are listed on the consent page that Google displays to the user.

Upvotes: 3

Rohan
Rohan

Reputation: 1352

Yes. You can authorize with multiple scopes. If you application can do multiple actions, you would need to add the relevant scopes so that the user can be authenticated and your application can execute the desired actions.

Upvotes: 0

Related Questions