PokeGOAPI-Java icon indicating copy to clipboard operation
PokeGOAPI-Java copied to clipboard

GoogleAutoCredentialProvider and GoogleUserCredentialProvider

Open pompobit opened this issue 10 years ago • 5 comments

I see that now there is a GoogleAutoCredentialProvider and a GoogleUserCredentialProvider but I'm a bit confused. Let's say the user finished the first step and entered a valid code, so I have a valid accessToken and a refreshToken.

Can i refresh the tokens without user intervention? To do it (if it is possible) I need to instantiate a new GoogleUserCredentialProvider passing the refreshToken to it or it is automatically refreshed on each server request (reading the code it seems that the token is refreshed on each getAuthInfo())?

What's the different use case for GoogleAutoCredentialProvider and GoogleUserCredentialProvider?

pompobit avatar Jul 30 '16 20:07 pompobit

There isnt difference in the use case, they should both have the same methods, but the login method isnt the same :

  • GoogleAutoCredentialProvider generate a token from google to get an token.
  • GoogleUserCredentialProvider use the raw login/password to get the token.

EDIT : Its the inverse, first one for raw login/password, second for token.

vmarchaud avatar Jul 30 '16 21:07 vmarchaud

OK clear thanks, and regarding the refresh policy? On 30 Jul 2016 23:02, "vmarchaud" [email protected] wrote:

There isnt difference in the use case, they should both have the same methods, but the login method isnt the same :

  • GoogleAutoCredentialProvider generate a token from google to get an token.
  • GoogleUserCredentialProvider use the raw login/password to get the token.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Grover-c13/PokeGOAPI-Java/issues/377#issuecomment-236389792, or mute the thread https://github.com/notifications/unsubscribe-auth/AF56myxzigqL6uCyib2hmcAI7zScEW6Xks5qa7wBgaJpZM4JY49M .

pompobit avatar Jul 30 '16 21:07 pompobit

@vmarchaud you have that backwards. It is GoogleUserCredentialProvider that uses the Refresh Token to get a token. Auto is the one that takes the raw login/password. Auto also doesn't allow 2 factor authentication and honestly it shouldn't be used or even in this API because it asks for you Google Login information.

s7092910 avatar Jul 30 '16 21:07 s7092910

@s7092910 Yep, wrote that fast with my phone, didnt check before posting, however someone said that you could setup a "application password" that doesnt require 2FA and that you could use this so use the GoogleAutoCredentialProvider.

vmarchaud avatar Jul 31 '16 00:07 vmarchaud

@vmarchaud @s7092910 Yes, you can set up application password and use it for username/password authentication instead of your standard password and as well bypassing 2FA.

thejavatar avatar Jul 31 '16 10:07 thejavatar