1
votes

Can I authorize multiple Google Accounts with single Google Drive API? Because when I am requesting this URI

https://accounts.google.com/o/oauth2/v2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly&access_type=offline&include_granted_scopes=true&state=teststate&redirect_uri=|+|redirecturi|+|&response_type=code&client_id=|+|clientid|+|

where |+|redirecturi|+| and |+|clientid|+| replaced by original one, so it is directly redirecting me to redirect_uri without opening consent screen.

1

1 Answers

0
votes

The way oauth2 works is a user must login to their google account and grant your aplication access to their data. The access token returned to you is bound to the client id that was used to created it. The consent screen will be displayed to the user and the code will be returned to your application at the redirect uri endpoint

The following url builds a consent form for the user.

https://accounts.google.com/o/oauth2/auth?client_id={clientid}.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=https://www.googleapis.com/auth/analytics.readonly&response_type=code

enter image description here

In this case asking them to grant your application "google analytics windows" access to your Google Analytcis account. Before the user sees this form they must be logged in.

Anwser:

There is no limit to the number of users who can consent to your application. Each user should be shown the consent screen and grant your application access you will be granted access to their data.