Robin B
Robin B

Reputation: 301

How to link a logged in user to a Facebook Identity provider in Okta

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.

Upvotes: 2

Views: 495

Answers (1)

Sohaib Ajmal
Sohaib Ajmal

Reputation: 261

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.

Upvotes: 2

Related Questions