Database Reference
In-Depth Information
redirect_uris field can be considered opaque. In a normal OAuth flow,
a redirect URI is provided to tell the Authorization Server what page to go to
after authorization is complete. When you authorize for an installed client,
however, this isn't needed. The urn:ietf:wg:oauth:2.0:oob value is
just a special identifier that says there isn't a page to go to, and instead, it
should show the result of the authorization flow.
OAuth Flow
There are a few different types of OAuth flow; however, as mentioned
before, you should likely not try to implement them yourself. Here we walk
you through the installed application flow, but the other types of flows
(service account and web server) are similar. The way to perform OAuth2
authorization in Python is to use your client_secrets.json file to
create a flow object:
$ python
>>>from oauth2client.client import
flow_from_clientsecrets
>>>BIGQUERY_SCOPE = 'https://www.googleapis.com/auth/
bigquery'
>>>flow =
flow_from_clientsecrets('client_secrets.json',
… scope=[BIGQUERY_SCOPE])
The scope parameter is what tells the authorization process that you want
to access BigQuery. If you want to access a different service as well as use
the same credentials, you could pass additional scopes here.
You likely don't want to rerun the full authorization flow each time you run
the application. The oauth2client storage object provides mechanisms to
save your credentials:
>>>from oauth2client.file import Storage
>>>storage = Storage('bigquery_credentials.dat')
>>>creds = storage.get()
In this case, we save the credentials to a file called
biguery_credentials.dat . If that file doesn't exist or doesn't have
Search WWH ::




Custom Search