# User\_id with SAML Connection (Salesforce as IdP)

**URL:** <https://community.auth0.com/t/user-id-with-saml-connection-salesforce-as-idp/117245>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [September 27, 2023, 12:36pm UTC](https://community.auth0.com/t/user-id-with-saml-connection-salesforce-as-idp/117245 "2023-09-27T12:36:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marc.porst](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@marc.porst](https://community.auth0.com/u/marc.porst)\
**Post date:** [September 27, 2023, 12:36pm UTC](https://community.auth0.com/t/user-id-with-saml-connection-salesforce-as-idp/117245/1 "2023-09-27T12:36:09Z")

</div>

We created a setup, where Salesforce is our Identity Provider and Auth0 is the Service Provider.  
So if the user opens one of our apps, for login the user will be forwarded to Salesforce and redirected after the Salesforce login.

Now we want to add all users via the Management API. We set the user\_id to a GID, which is also in Salesforce. So after user creation, the user\_id is “auth0|{GID}”.  
Now, we want the user to be identified via the GID. So in the managed app in Salesforce, we added a Custom Attribute user\_gid that contains the GID.

In the mapping of the SAML connection, we did:  
{  
“user\_id”: “user\_gid”  
}

When I try this within one of our apps, Auth0 creates automatically a new user with the user\_id “samlp|SFQANEW|{GID}”, SFQANEW is the SAML connection.

But the one I created before is not used. Is there any way SAML can use the user we created via the Management API?

Thanks,

Marc

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [September 29, 2023, 12:48pm UTC](https://community.auth0.com/t/user-id-with-saml-connection-salesforce-as-idp/117245/3 "2023-09-29T12:48:57Z")

</div>

Hi @marc.porst,

Welcome to the Auth0 Community!

For connections where Auth0 is the service provider, user creation is delegated to the IdP. In this case, for a user to be created successfully, they must log in through Salesforce and are then created automatically within Auth0.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![marc.porst](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@marc.porst](https://community.auth0.com/u/marc.porst)\
**Post date:** [October 4, 2023, 9:21am UTC](https://community.auth0.com/t/user-id-with-saml-connection-salesforce-as-idp/117245/4 "2023-10-04T09:21:29Z")

</div>

Hey @dan.woda,

thanks for your help. So we decided to link the users created by the IdP and the user we created via the management API.

Best,

Marc

---

<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:** [October 18, 2023, 9:21am UTC](https://community.auth0.com/t/user-id-with-saml-connection-salesforce-as-idp/117245/5 "2023-10-18T09:21:54Z")

</div>

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