Code Monkey home page Code Monkey logo

Comments (5)

GabiAxel avatar GabiAxel commented on May 28, 2024

The above code has been integrated into the project.
Thanks @Gorbas

from spring-social-google.

boberj avatar boberj commented on May 28, 2024

I don't think this is correct. User id is not the same as username. The username can change whereas the user id cannot. This will be a problem if you are planning to store the data keyed by the user id.

The above code also causes the Connection.getKey().getProviderUserId() to return different values depending on what scopes you have requested. If you don't have the https://www.googleapis.com/auth/userinfo.email scope getUsername() will return null and the default initialization sequence will take place instead (see below).

The code should work without implementing extractProviderUserId() since the user id will by default be initialized in AbstractConnection.initKey()

from spring-social-google.

ejwood79 avatar ejwood79 commented on May 28, 2024

@boberj's comment is correct - Connecton.getKey().getProviderUserId() does indeed return different values depending on the requested scope. That makes it very difficult to use the API out of the box and expect consistent results. Is there a way around this behavior?

from spring-social-google.

jramsdale avatar jramsdale commented on May 28, 2024

Ping? This is a pretty big issue for us and our use of this library. I'd hope getProviderUserId() could return the numerical user id as described by @azpublic in #41 ?

from spring-social-google.

ejwood79 avatar ejwood79 commented on May 28, 2024

I worked around this as follows:

Google google = (Google)connection.getApi();
String uid = google.userOperations().getUserInfo().getId();

from spring-social-google.

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.