I’m trying to add “Sign in with Twitter” thing to my web application.
I configured spring security and social and everything works i.e. I can fetch user name, access key, access secret etc., but when I want to get user email from fetched profile I’m getting null.
My code inside of controller (spring redirect to this after successful authorization) looks like this:
Connection<A> connection = providerSignInUtils.getConnectionFromSession(request); String email = connection.fetchUserProfile().getEmail();
I know you have to whitelist application, check “Request email addresses from users” field, refresh user’s access tokens etc. I did that all already and still getting null. I’m out of ideas what to do, I tried “/auth/twitter?scope=email” instead of “/auth/twitter” trick but does not work. Maybe it’s something wrong with Spring? I’m using newest spring-social 1.1.4 with spring twitter API 1.1.2.
I saw many question about this issue but all of them were from 2011/2012, AFAIK Twitter didn’t support fetching email address from user back then, but it changed, however it still doesn’t seem to work properly.