From the Google documentation, there is an example that references a variable named $scopes
:
$scopes = array('https://www.googleapis.com/auth/sqlservice.admin');
This is for sqlservice. I want to use a different scope. How do I choose the right scope? And how do I know it's the right service for what I want? Is there a list of scopes somewhere that match up to which URL's to use?
That line of code returns an array, even though there is no sqlservice.admin file in the auth folder.
I need to use the drive service.
I'm assuming that I should change that line to:
$scopes = array('https://www.googleapis.com/src/drive.php');
But how that integrates into the bigger picture, I don't understand. Do I also need to call OAuth2.php
at some point?
I just realized that the array is pointing towards a https://www.googleapis.com/src/
web address and not a file. And I was looking at the OAuth 2.0 Playground, and there is a list of all the scopes.
And I just noticed that if I hover over an item in the list, a help context balloon appears.
So, I guess I can get a list of scopes and descriptions of the scopes from there, although I'd still like to know if there is an official list somewhere other than on the OAuth2 playground.
Each scope is a URN. They also seem to be URL's, but I don't think that's significant. For your app, it's just a string (or list/array of strings - you can specify more than one) that you need to spell correctly. Each Google service supports a range of scopes, each of which grants different permissions. Generally, somewhere within the documentation pages for each service, you'll find a single page that defines the available scopes. In the case of the Drive service, the scopes are defined at https://developers.google.com/drive/web/scopes