Android AccountManager authToken and OAuth

My task is to write an IMAP email client for Gmail. Until now, I know that the client must authenticate through OAuth (there is also a java library for IMAP authentication from Google). But I would like the user to not enter a password.

Android provides a great β€œnative” way to get authToken for google account services through the AccountManager. But I'm wondering how to use authToken and what is it for? Is it for GAE authentication only?

Is there a way to get oauthToken and oauthTokenSecret without a browser (via AccountManager)?

+6
source share
1 answer

Did you try to use " oauth2:https://mail.google.com/ " as a "type of authorization token" ( authTokenType parameter) when calling AccountManager.getAutToken() ?

According to what was said at 46:50 in the conversation that you spoke about , it should work.

By the way, this page describes how to get the OAuth2 token for Google Tasks and a link to sample code . It also makes it sound like it's a matter of providing the correct authTokenType parameter.

+4
source

Source: https://habr.com/ru/post/892481/


All Articles