2

I want to create some mail apps , and I want as first step the user login with his Google account (just in first time) and then to get all messages / sent messages after the authentication

I see many issues about this question like:

But I did not find any clear question as to what is the best way to go.

So I try to understand what is the best option for me? I try 2 different options:

  1. Google Sign-in button on Android - I success to create the sign-in but I couldn't add Gmail scopes to GoogleSignInOptions object because it's not part of the the built scopes , any question that I see get is just the basic information about user but it's not my purpose .

  2. Android quick start for Gmail API - Also here I run this but I don't know why there is the first part of getting permissions for contacts?? If somehow I can do this without this step it will be great, and maybe it's the best option (?)

My third option is that I don't find it's to use Gmail REST API with refresh and access token because I know it and already use it in different issues but I think this is not the case here.

So in summary - for my purpose, what way I need to choose ?

Community
  • 1
  • 1
OriEng
  • 1,424
  • 18
  • 34

1 Answers1

0

I asked this question yesterday here.

The Google sign-in button is just an account authentication if you want to get the messages you should use the second option

Diiscord
  • 101
  • 1
  • 7
  • Tnx , I know the big idea... but there is a level of get permissions of accounts in the second option and I not real understand way it is necessary .. There is many option in many different answers but nothing is not real clear . – OriEng Apr 19 '17 at 09:06
  • Depending on what you want to do with the mails, the scope https://mail.google.com/ or https://www.googleapis.com/auth/gmail.readonly should be enough – Diiscord Apr 19 '17 at 11:31
  • Sorry it's not what I mean ... if you using Android quick start for Gmail API So first time user sign-in it's request permissions for contacts and I don't know why , when I try to cancel it it's just not work ... – OriEng Apr 19 '17 at 12:07
  • So what's your question here ? – Diiscord Apr 19 '17 at 12:20
  • Why we must get permissions for contacts for first time , and if this is best option or there is something better .... – OriEng Apr 19 '17 at 13:11
  • The android contact permission is to access the google account. As you may know contacts are saved with your google account, so if you change your phone you keep all your contacts. I don't know if this is the best option but it's the one in the android quickstart and it worked fine for me – Diiscord Apr 19 '17 at 14:55