Persisting Auth info
There is currently no way to persist auth info. This is useful for apps where a user will login and then use and exit the app, as the next time they open the app their auth info can be retrieved from disk instead of requiring them to log in again.
It shouldn't be done on the API/SDK/Library side. ❌
So you think logging in should be in the API, but refreshing an earlier token coming from inside the API should be done by another dev themselves?
@jabbink refreshing the token is not what @Aphoh is asking. My understanding of this issue is "store the username/password on the disk". <- this should be done in the client.
Oh, from the discussion we had in Slack about this, I think @Aphoh means that you can give a refresh token (stored by another application, not this library) and this API will refresh it, so it doesn't have to fully login again with username/password.
@Aphoh, please clarify what you mean <3
Oh, that would make sense and would be good to have IMHO 😄
I meant there must be a way to reconstruct/refresh the AuthInfo class from a token. The storing should be done by the client.
Added this method wit my PR, should be enough to refresh the AuthInfo used by the client.
What was your idea on getting that new, valid AuthInfo without using a username and password?
This is temporary method to let user that know how to get a valid AuthInfo refresh the AuthInfo that the request handler use. Tbh i forgot that i had added these line, was justing for testing at the time.
... Looked into other projects how they do this and they store the expiry date for the ticket, and when it expires, re login with username/password...
Will look into the network traffic of the official app to see how that one does it.
Also the refresh token expires after 30 mins ..
Looked into the traffic of the official app (only PTC) and can't seem to see how it gets the initial token now...
OAUTH login shouldn't need your credentials ever - the Google login doesn't actually use what you pass it. You provide the credentials when you follow the link and authenticate the "device" with Google.
&access_type=offline in GoogleLogin.java:48 to include the refresh token in the response.