# How to create & link social accounts with organizations?

**URL:** <https://community.auth0.com/t/how-to-create-link-social-accounts-with-organizations/196427>\
**Category:** Get Help\
**Tags:** signup-prompt-new-experience, login-experience\
**Created:** [January 21, 2026, 12:26am UTC](https://community.auth0.com/t/how-to-create-link-social-accounts-with-organizations/196427 "2026-01-21T00:26:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PatrickHeneise](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/patrickheneise/32/39821_2.png) [@PatrickHeneise](https://community.auth0.com/u/PatrickHeneise)\
**Post date:** [January 21, 2026, 12:26am UTC](https://community.auth0.com/t/how-to-create-link-social-accounts-with-organizations/196427/1 "2026-01-21T00:26:46Z")

</div>

Hi there. I’m struggling with a relatively basic use case and can’t find an answer for it.

I have “Organizations” turned on and required for my app. Users can sign in via email/pw or a social provider (ie GitHub). I’m trying to add a “Add a social provider” function, but the frontend & backend flows are distinct from another and if the email doesn’t match for the two accounts, there’s somehow no way to link them. The callback from GitHub works and auth0 creates a new social user, but the primary user id is missing in the backend request, and the frontend doesn’t get the secondary (social) user id, so I can’t connect the two?

What’s the best way to handle this?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [January 21, 2026, 6:09pm UTC](https://community.auth0.com/t/how-to-create-link-social-accounts-with-organizations/196427/3 "2026-01-21T18:09:24Z")

</div>

Hi @PatrickHeneise

Welcome back to the Auth0 Community!

From what I understand, it appears that when the user tries to add a social account, their session is being replaced with the social one instead of keeping the initial session and just extracting the profile information in order to initiate the account linking. Your main approach would be to link the account depending on the user validating the credentials and not link them if the emails are matching since some social providers do not require you to have an email attached to the account.

Since the approach that you are talking about appears to be a User Initiated Account Linking, you would need to first have the user authenticate inside the app and then verify the credentials of the account that they wish to link.

I would highly recommend going through our [User Account Linking](https://auth0.com/docs/manage-users/user-accounts/user-account-linking) documentation since it should tackle the issue of the email address not matching because this type of account linking can be done regardless of that. If you have any other questions or issues, let me know!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![PatrickHeneise](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/patrickheneise/32/39821_2.png) [@PatrickHeneise](https://community.auth0.com/u/PatrickHeneise)\
**Post date:** [January 21, 2026, 7:08pm UTC](https://community.auth0.com/t/how-to-create-link-social-accounts-with-organizations/196427/4 "2026-01-21T19:08:12Z")

</div>

Thanks @nik.baleca! I’ve been going through several iterations based on the account linking docs, hence my question here as it’s not working as expected.

I tried both the popup and redirect to the auth0 screen to authenticate GitHub. The problem with the account linking is that both accounts need to exist, so I initiate the account creation and that works. The session/JWT is _not_ replaced, I’m still logged in with my username/password account, but I get an error that the new user requires organization membership. In the callback from auth0 I don’t seem to get the secondary account ID, so I can’t send that to my backend to link the accounts.

I’m using the react-sdk and followed this example here [auth0-link-accounts-sample/SPA/public/js/app.js at master · auth0-samples/auth0-link-accounts-sample · GitHub](https://github.com/auth0-samples/auth0-link-accounts-sample/blob/master/SPA/public/js/app.js#L63) - what am I missing?

---

<div class="post-metadata">

**Author:** ![PatrickHeneise](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/patrickheneise/32/39821_2.png) [@PatrickHeneise](https://community.auth0.com/u/PatrickHeneise)\
**Post date:** [January 22, 2026, 1:48am UTC](https://community.auth0.com/t/how-to-create-link-social-accounts-with-organizations/196427/5 "2026-01-22T01:48:53Z")

</div>

This is what Claude tells me the problem is:

1. **User clicks “Link GitHub”** → useGitHubLinking redirects to https://{domain}/authorize?..

2. **Auth0 authorization endpoint** checks organization\_usage = “require” on the client

3. **Auth0 blocks the request** because we’re not passing an organization parameter (by design - the secondary account doesn’t belong to any org yet)

4. **Auth0 redirects back** to our callback with error=invalid\_request&error\_description=client requires organization membership…

5. **Our callback code** reads the error parameters and displays them (working correctly)

Is that truly the problem, that I require the organization? The (GitHub) user is created in Auth0 without the org, so linking it to an account with org _should_ be possible, no?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [January 22, 2026, 6:35pm UTC](https://community.auth0.com/t/how-to-create-link-social-accounts-with-organizations/196427/6 "2026-01-22T18:35:06Z")

</div>

Got it, thanks for the additional info.

Can you try the following approach in your implementation since you are using organizations?

- Once the user clicks Link Github, redirect them manually to the `/authorize` endpoint and use `response_mode=query` and a specific `redirect_uri` for linking. An example of such an authorize call using JS would be:

```auto
const linkRedirectUri = 'https://yourapp.com/link-callback';
const primaryUserId = 'USER_ID_FROM_CURRENT_SESSION';

const authorizeUrl = "https://YOUR_AUTH0_DOMAIN/authorize?
client_id=YOUR_CLIENT_ID&
connection=github&
redirect_uri=${linkRedirectUri}&
response_type=code&  
scope=openid profile email&
state=${primaryUserId}"
  
window.location.assign(authorizeUrl);

```

- Once the user is redirected back to the callback route, the URL will contain a `code` and `state`. You will need to send the code to your backend in order to exchange it for a token against the `/oauth/token` endpoint in order to receive the **Access and Id Tokens** for the respective users.
- You can either decode the token or call the `/userinfo` endpoint to retrieve the `sub` claim of the github user
- Now, you should be able to make a call to the Management API to link the users or proceed to link the users

Let me know if the proposed solution helps you with the issue or not!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 5, 2026, 6:35pm UTC](https://community.auth0.com/t/how-to-create-link-social-accounts-with-organizations/196427/7 "2026-02-05T18:35:09Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
