Comments (16)
I believe refreshing solves that.
from blossomspokemongomanager.
I guess the Google token given by Google API is just a shortToken. That means it doesn't last long. We need to check if that's the case.
If so, we need to refresh the token from time to time via Google API.
from blossomspokemongomanager.
@torin555 it does not. Relogging is necessary.
from blossomspokemongomanager.
It seems to be refreshing my token:
> [08/05 00:32:41]: D/GoogleUserCredentialProvider: 3600
> [08/05 00:32:41]: D/GoogleUserCredentialProvider: Refreshed Token eJhbGciOiUz1NisImtpI6IjBmMmY1ZTMxNjE0YmIxYTc4ZjkxNTYxZWIxMmE2I5ZjUwNTQ2NDMifQ.eyJpc3MiOiJodHwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhdF9oYXNoIjoiXTeGFPWEZ5eDUyWnJudGOVItdyIsImF1ZCI6Ig0ODIzUxMTI0MC03M3JpM3Q3cGx2azk2cGo0Zjg1dWo4b3RkYXQyYWxShcHBzLmdvb2dsZXVZXJjb0WLmNvbSIsInN1YiI6IjEwMDEyMDIyMzIzk5MTIwNzEyMCIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJhnAiOiINDgyMzI1MTEyNDAtNzNyaTN0N3Bsdms5NnBqNGVqOG90ZGF0MFsZW0uYBwcy5nb29nbGV12VyY29uGVudC5jb20iLCJlbWFpbCI6InvcumtvZ3V0QGNvbWNc3QubmVIiaWF0IjoxNDcwzc4NzYyLJleHAOjE0NzzODIzNjJ9iyFLZk8NQ2tiUlfdPOWDLEuO8RdlQArvW1lFFrInQX5dlCPNg3DDdrbVEJEFXV2WIQtcEoyqVtXeQUNYctr9e50GpQvfFYxDMNKuyNplUONNgE7fRwtQLoLQFZ4zBIPcQ8S3UPatrpDz5gBtcl01zVqSLxEMRQ5c40teMzPA_g5ELjppO068L6Bi-2qLKEiG3bcNJOnhNQwI9LXhZHVKkQZKduQj1hwqYSM-19KwL3Bxrg7AuW5IpCBHQg36HmIIRAv92sR9BDWe3UNIjochK3ITnzm4OA4a7jljcSqbTccx5A
(I've heavily modified the token for obvious reasons.)
This was after leaving the program open over night, after doing that it just says:
> [08/05 01:26:04]: D/RequestHandler: Authenticated with static token
> [08/05 01:26:05]: Done refreshing Pokémon list
from blossomspokemongomanager.
I remember something about the tokens only being viable for five minutes before needing to be refreshed. Should we be implementing something that tests for a time-out, and tries to refresh the token automatically?
from blossomspokemongomanager.
According to https://developers.google.com/api-client-library/java/google-api-java-client/oauth2 the token lasts for 1 hour before needing a refresh. I believe that's already being handled though which would make this bug something different. Line 166 of the main java file (refresh starting at 189):
> //Using Google, remove PTC infos
> loginconf.remove("PTCUsername");
> loginconf.remove("PTCPassword");
> String authCode = loginconf.optString("GoogleAuthToken", null);
> boolean refresh = false;
> if(authCode == null) {
> //We need to get the auth code, as we do not have it yet.
> UIManager.put("OptionPane.okButtonText", "Ok");
> JOptionPane.showMessageDialog(null, "You will need to provide a google authentication key to log in. Press OK to continue.", "Google Auth", JOptionPane.PLAIN_MESSAGE);
> //We're gonna try to load the page using the users browser
> if(Desktop.isDesktopSupported()) {
> JOptionPane.showMessageDialog(null, "A webpage should open up, please allow the permissions, and then copy the code into your clipboard. Press OK to continue", "Google Auth", JOptionPane.PLAIN_MESSAGE);
> Desktop.getDesktop().browse(new URI(GoogleUserCredentialProvider.LOGIN_URL));
> } else {
> UIManager.put("OptionPane.cancelButtonText", "Copy To Clipboard");
> if(JOptionPane.showConfirmDialog(null, "Please copy this link and paste it into a browser.\nThen, allow the permissions, and copy the code into your clipboard.", "Google Auth", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.CANCEL_OPTION){
> StringSelection ss = new StringSelection(GoogleUserCredentialProvider.LOGIN_URL);
> Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, ss);
> }
> UIManager.put("OptionPane.cancelButtonText", "Cancel");
> }
> //The user should have the auth code now. Lets get it.
> authCode = JOptionPane.showInputDialog(null, "Please provide the authentication code", "Google Auth", JOptionPane.PLAIN_MESSAGE);
> } else {
> refresh = true;
> }
> try {
> GoogleUserCredentialProvider provider = new GoogleUserCredentialProvider(http);
> if(refresh) provider.refreshToken(authCode);
> else provider.login(authCode);
> cp = provider;
> if(loginconf.optBoolean("SaveAuth", false) || checkSaveAuth()){
> if(!refresh) loginconf.put("GoogleAuthToken", provider.getRefreshToken());
> loginconf.put("SaveAuth", true);
> } else {
> loginconf.remove("GoogleAuthToken");
> loginconf.remove("SaveAuth");
> }
> } catch (Exception e) {
> alertFailedLogin();
> continue;
> }
from blossomspokemongomanager.
Yeah, seems like refresh is already included.
from blossomspokemongomanager.
I remember something about auth codes that were a line long and an auth code that looked like a paragraph. The short started with something like o/... while the long looked closer to what @torin555 was showing. Could we be generating our google token incorrectly?
from blossomspokemongomanager.
That's what I meant with short- and longtokens. Short tokens can be generated by the user. Like on that webpage.
A token that lasts longer hast to be queried directly by the application. That's our app.
Yeah, we need to check that.
from blossomspokemongomanager.
Someone experienced that error again?
I've never seen it. For me always when the session times out it refreshes the token and writes that down.
from blossomspokemongomanager.
@Wolfsblvt I haven't seen this particular error in a while. I did see it when this was first posted, but for me refreshing the list always fixed it. But I haven't seen it for at least a few days.
from blossomspokemongomanager.
Maybe we shouldn't fix it, but just handle the error more gracefully, like restarting the tool?
from blossomspokemongomanager.
That's an idea. I honestly have no clue what would be causing this error. All it seems to be saying is that the request to refresh the token is invalid for some reason. Maybe Google deactivates a token completely if it's been inactive for a while to the point it can't be refreshed anymore? That would explain why you sometimes need to re-login through google when you're using google as a login for a website or something. Other then that I'm coming up empty.
from blossomspokemongomanager.
Also getting this error sometimes.
Might be hitting rate limit, single client_id/client_secret is used for all refresh requests made by the com.pokegoapi.auth.GoogleUserCredentialProvider
from blossomspokemongomanager.
I read that it was actually a bug with the PokeGo-API and that it is already fixed and will be part of their next version.
We will see when we will/can upgrade to it.
from blossomspokemongomanager.
We have upgraded, so this issue should be fixed.
from blossomspokemongomanager.
Related Issues (20)
- Rename Issue HOT 6
- "refresh list" not reliable HOT 2
- Babies aren't evolvable HOT 1
- Release Zips Won't Download HOT 5
- Not a issue, more of a question HOT 2
- Small typo in PokeHandler.java, line 222: says {2] instead of [2]
- closed, wasn't thinking straight HOT 1
- Unicode display issue iPhone vs BPGM for sword and shield
- Can't login since force update 0.57.4 HOT 6
- I can no longer log in from around 2017/03/08 AM 10:30(JST). HOT 17
- Warning from Niantec on my phone when opening app HOT 9
- AsyncPokemonGoException error HOT 17
- Impossible to connect with google account (no proxy/vpn/firewall) HOT 4
- Question: Is this project dead? HOT 5
- Hashkeys HOT 9
- Unable to power up past lvl39.5 HOT 1
- Cannot login with password containing '`' character HOT 1
- Login Failed Exception:
- IndexOutOfBoundsException Login Error
- Naming moveset to 4 characters HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blossomspokemongomanager.