Sign in after organisation selection
When the user signs in and needs to choose for a organisation. The claims in the token does not show which organisation the user had choosen. How do we need to find out what the user choose?
3 Replies
Hi, thanks for your question!
When a user signs in and is associated with multiple organizations, Kinde provides tokens that include both the currently selected organization and a list of all organizations the user belongs to.
Here’s how you can retrieve that information:
✅ Get the currently selected organization:
Use the
Use
If you’d like to allow users to switch organizations within your app, you can implement an organization switcher using the
🔗 Navigate between organizations Let me know if that helps, or if you'd like a hand setting it up!
Use the
getOrganization()
helper method. It returns an object with the orgCode
of the active organization the user chose during login:
✅ Get all organizations the user belongs to:Use
getUserOrganizations()
. This returns an array of all orgCodes
the user is linked to:
You can also find these in the ID token, under the org_codes
claim for the full list, and org_code
for the current one.
🔄 Switching between organizations:If you’d like to allow users to switch organizations within your app, you can implement an organization switcher using the
login()
method with the desired org_code
. Full guide here:🔗 Navigate between organizations Let me know if that helps, or if you'd like a hand setting it up!
Kinde docs
Build a switch to navigate between organizations
Our developer tools provide everything you need to get started with Kinde.
Thanks, but when i use the .NET SDK i get the followoing error when retrieving the organization:
Error calling GetOrganization: {"errors": [{"code": "CODE_IS_REQUIRED", "message": "Code is required"}, {"code": "ORGANIZATION_INVALID", "message": "Invalid organization"}]}
Example code:
See https://discord.com/channels/1070212618549219328/1364986715336347658
Thanks for sharing the link to the other thread — let’s continue the conversation there to keep everything in one place. Appreciate you flagging it!