-
Notifications
You must be signed in to change notification settings - Fork 67
spring-social-github can't get user email #29
Comments
The problem is that this library uses following https://api.github.com/user endpoint in order to get user profile. That endpoint returns the public email address for the user, and users don't need to specify a public email address. So, if the user doesn't have a public email address defined -- you get a null value back. The https://api.github.com/user/emails endpoint returns the private list of email addresses and that list should always have at least one address. if it possible to extend spring-social-github library in order to call https://api.github.com/user/emails endpoint for user email address ? Right now I'm unable override GitHubTemplate.initSubApis() in order to initialize my own version of UserTemplate.getUserProfile() because GitHub Template.initSubApis is private method.. My StackOverflow issue for this one: http://stackoverflow.com/questions/29986218/spring-social-github-cant-get-user-email |
Maybe this can help. Have a look at UsersTemplate, operations on email are supported. Improvements? Issues and PRs are welcome. |
One Email has a primary flag, I'd expect to set that one on the |
Did you manage to find the solution of how to get github user email? |
I solved it like this in my project: @value("${github.resource.userInfoUri}") public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { } |
which us userInfoUri? https://api.github.com/user ? |
Yep : https://api.github.com/user Be careful, you might get a unverified email address. |
I get a 404 doing:
Also I get 404 when I try with curl :
|
solved I was using the wrong scope |
I'm using spring-social/spring-social-github in order to authenticate user through GitHub in my Spring Boot web application.
In order to sign in user I have created following html form:
everything works fine except I can't get user email address.
According to GitHub documentation https://developer.github.com/v3/oauth/#scopes GitHub OAuth API user scope includes user:email and user:follow.
What can be wrong ?
The text was updated successfully, but these errors were encountered: