Giter VIP home page Giter VIP logo

Comments (16)

xephael avatar xephael commented on May 26, 2024

I believe refreshing solves that.

from blossomspokemongomanager.

Wolfsblvt avatar Wolfsblvt commented on May 26, 2024

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.

wullxz avatar wullxz commented on May 26, 2024

@torin555 it does not. Relogging is necessary.

from blossomspokemongomanager.

xephael avatar xephael commented on May 26, 2024

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.

 avatar commented on May 26, 2024

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.

xephael avatar xephael commented on May 26, 2024

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.

Wolfsblvt avatar Wolfsblvt commented on May 26, 2024

Yeah, seems like refresh is already included.

from blossomspokemongomanager.

weblue avatar weblue commented on May 26, 2024

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.

Wolfsblvt avatar Wolfsblvt commented on May 26, 2024

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.

Wolfsblvt avatar Wolfsblvt commented on May 26, 2024

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.

xephael avatar xephael commented on May 26, 2024

@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.

#192

from blossomspokemongomanager.

Wolfsblvt avatar Wolfsblvt commented on May 26, 2024

Maybe we shouldn't fix it, but just handle the error more gracefully, like restarting the tool?

from blossomspokemongomanager.

xephael avatar xephael commented on May 26, 2024

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.

nts64 avatar nts64 commented on May 26, 2024

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.

Wolfsblvt avatar Wolfsblvt commented on May 26, 2024

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.

Wolfsblvt avatar Wolfsblvt commented on May 26, 2024

We have upgraded, so this issue should be fixed.

from blossomspokemongomanager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.