Auth0 Home Blog Docs

Enrich profile with Email for Vkontakte

social-connections
rules
login
vkontakte

#1

I’m trying to find a way to enrich profile with email for Vkontakte social connection. The problem is that even with email scope there is no email in user profile by default right now on Auth0. Vkontakte returns email in same array where access_token returned after auth flow and you can’t get it in any other way (via API or something).

Is it possible to achieve with Rules or Hooks and if answer is yes - how to do that? I’ve tried to create Rule to get extra request to Vkontakte oauth flow but I can’t find how to get client_id, client_secret and CODE in Rule context. Please advise.

Thank you!


#3

Hey there @lizaonair, I’m looking into a solution for you but I believe rules should be the right path in your journey. I have linked the documentation below regards to the matter for context reference for others while I look into this. Thanks.


#4

Hello! I’ve tried to implement my VK connection via Custom Social Connections, but still, can’t find the way to have an access to connection configuration (app id, secret, etc.) and access_token oauth endpoint response.


#5

I’m currently working on fielding a solution with our Support team and will relay what their insight is. Thanks!


#6

Rules won’t let you intercept the OAuth2 conversation between Auth0 and vK, so you won’t be able to fix the default VK connection behavior using rules.

I believe it should be possible to get the email using a custom social connection though, by:

  • Requesting an email scope
  • In the user profile function, use ctx.email to get the email address from the token response.

Have you tried the above?


#7

Thank you! Looks like I’ve made a typo with scope name and didn’t checked for available email field in ctx! Now it works fine!


#8

The only question now - how to add custom class name to Custom Social Connections buttons on Lock screen?! If I have more than 1 - there is no way to style it without :nth-child() selectors and I don’t like it.


#9

There’s no way to specify a CSS class for now, but you can configure other settings for the button, including colors and the icon of the button. Take a look at https://auth0.com/docs/libraries/lock/v11/configuration#authbuttons-object-.

Would that work?


#10

This works even better! Thanks!