Android Question Oauth2 multiple scopes (HowTo)

alain bertrand

Member
Licensed User
An app's activity uses Modules GoogleDrive.bas and GoogleOAuth2 to backup/restore SQLite.db. 100% working.
My aim is to make another activity sending Mail. Gmail service is added in Google console.
I'm in total confusion.
At each Activity_Create (at firsttime) oaut2.initialize(Me) it's own scope (.../drive and .../gmail.send, repectively).
At each Activity_Resume: oauth2.CallFromResume(Activity.GetStartingIntent).
No error log but no mail is sent and after "Allow" in Chrome, the app displays the backup activity instead of the mail activity.
How (and where) to initialize several scopes for an App?
I guess a single valid Token is OK for both services.
 

DonManfred

Expert
Licensed User
I guess you need to use 2 instances of the oauth2 library each pointing to the correct tokenstore and using the right scopes.
I suggest to use a dedicated folder for each instance.

I guess a single valid Token is OK for both services.
Have you tried to use the different scopes in the oauth intializing?
They must be comma separated.

I fear it only works with one service. For Drive you may have different scopes though. This will work.
Gmail is another service which requires another scope.
 
Last edited:
Upvote 0
Top