2

I'm currently working on a project where we want to connect facebook profiles to existing (and logged in) Okta users.

The website is made in ASP.NET using Sitecore 6.5.

We use the "Authorize URL" to do our login and account linking with redirect callouts.

I can register and create an account with the facebook identity provider when the user isn't logged in in Okta. In this case it follows the Callout redirects and we get a tx_id. Hover when you're logged in to Okta and you visit the same "Athorize URL" it follows the redirect_uri where you get a id_token as result. this is an JWT string which I managed to decode (example result).

How can I use the information in the JWT to link a user to the identity provider? Or is there another way to do this? I can't find any methods or API calls to add a user to an identity provider without the tx_id.

Robin B
  • 301
  • 1
  • 4

1 Answers1

2

I believe you used https://developer.okta.com/docs/api/resources/social_authentication.html to add FB social auth for users. Yes, once you browse the final url

https://example.okta.com/oauth2/v1/authorize?idp=0oa0bcde12fghiJkl3m4&client_id=AbcDE0fGHI1jk2LM34no&scope=openid%20email%20profile&response_type=id_token&response_mode=fragment&state=someState&nonce=someNonce&redirect_uri=https://app.example.com/social_auth

you will be redirected to your app https://app.example.com/social_auth with id token in the url. In the redirected app you can read, decode and create session for user. However, the same user profile is also created in Okta.

Once the social auth user profile is created in Okta, you can use that to get id token next time.

Sohaib Ajmal
  • 261
  • 1
  • 4
  • Thanks for your answer. I can't get it to work however. When a user isn't loged in I can do your steps. But when he is logged in I directly get the id_token with the social information. I can't make any session or can't link the idp to the user with it (or don't know how). Do you maybe have a code example or a sort of flow where I can see the api/redirect calls? I'm also going to log a ticket at Okta. Will keep you updated. – Robin B Dec 06 '16 at 08:11