bland-finland-95044
02/14/2025, 8:52 PMbrief-egg-61061
02/14/2025, 8:52 PMbrief-egg-61061
02/14/2025, 8:52 PMbland-finland-95044
02/17/2025, 8:03 PMory
.createBrowserSettingsFlow({
returnTo: returnTo,
})
Then I update the settings flow like this:
const body: UpdateSettingsFlowBody = {
method: "oidc",
link: "SSO_PROVIDER_FOR_ORG_HERE",
};
ory
.updateSettingsFlow({
flow: String(flow.id),
updateSettingsFlowBody: body,
})
.then(({ data }) => {
setFlow(data);
if (returnTo) {
router.push(returnTo || window.location.origin);
}
})
.catch((err: unknown) => {
if (err instanceof AxiosError && err.response?.status === 422) {
const errorData = err.response.data;
if (errorData.redirect_browser_to) {
console.log(errorData.redirect_browser_to as string);
}
} else {
setLoading(false);
}
});
That returns a 422 response that contains redirect_browser_to
field with a URL from my SSO provider. If I redirect the browser to the URL, it successfully links the SSO account, but then the user gets sent to an error page:
An error occurred with the following message: The settings flow is disabled for this organization
How else am I supposed to link an SSO provider without a settings flow? It seems like the settings flow half-way works, since it does link the SSO account. Am I approaching this the wrong way?
I did try setting After OIDC Redirect URL
to our application URL, no luck therebrief-egg-61061
02/17/2025, 8:03 PMbrief-egg-61061
02/17/2025, 8:03 PMredirect_browser_to
) seems to be the correct way to initiate the SSO linking process. The fact that it successfully links the account suggests this part is working as intended.
4. The error you're encountering after the successful link might be due to the settings flow being disabled for organizations. You might need to handle this redirect differently for Enterprise SSO Organizations.
Unfortunately, the provided knowledge sources don't contain enough information to give a definitive solution to your specific use case. It seems that handling Enterprise SSO Organizations with a custom UI might require a different approach than the standard settings flow.brief-egg-61061
02/17/2025, 8:03 PMredirect_browser_to
) seems to be the correct way to initiate the SSO linking process. The fact that it successfully links the account suggests this part is working as intended. 4. The error you're encountering after the successful link might be due to the settings flow being disabled for organizations. You might need to handle this redirect differently for Enterprise SSO Organizations. Unfortunately, the provided knowledge sources don't contain enough information to give a definitive solution to your specific use case. It seems that handling Enterprise SSO Organizations with a custom UI might require a different approach than the standard settings flow. I would recommend reaching out to Ory support for more specific guidance on how to handle SSO linking for Enterprise SSO Organizations using a custom UI. They should be able to provide you with the correct API endpoints and workflow for your specific use case.bland-finland-95044
02/17/2025, 8:29 PMbrief-egg-61061
02/17/2025, 8:29 PMbrief-egg-61061
02/17/2025, 8:29 PMGET /projects/{project_id}/organizations
This endpoint is described in the [Ory API Reference](https://www.ory.sh/docs/reference/api). You'll need to authenticate your request using your workspace API key. 2. Once you have the organization ID, you can get the details of the specific organization using: GET /projects/{project_id}/organizations/{organization_id}
This endpoint is also described in the [Ory API Reference](https://www.ory.sh/docs/reference/api). 3. To get the SSO providers (OIDC connections) for the organization, you need to query the project configuration. You can use this curl command: bash curl -X GET --location "<https://api.console.ory.sh/projects/$PROJECT_ID>" \ -H "Authorization: Bearer $WORKSPACE_API_KEY" \ | jq ".services.identity.config.selfservice.methods.oidc.config.providers"
This command is provided in the [Create SSO connections for an organization documentation](https://www.ory.sh/docs/kratos/organizations#create-sso-connections-for-an-organization). The response will include all SSO providers configured for your project. Each provider object in the response will include an organization_id
field. You can filter the results to find the provider(s) associated with your specific organization. Here's an example of what a provider object in the response might look like: json { "client_id": "...", "client_secret": "...", "id": "ory-GPx1yPH4", "issuer_url": "<https://example.org>", "label": "My OIDC provider", "mapper_url": "<https://storage.googleapis.com/bac-gcs-production/94292215dbabe405bebff988b5356663fcf5cba35b10fc6ca2cfea7bc7049e906e01d271a3daeb844203efdfbf2cff356274daa63d5afc2a379bbe93b8b40e63.jsonnet>", "organization_id": "6bb1c7d1-3b3e-4995-9e09-35649dc45a2b", "provider": "generic", "scope": ["openid", "offline_access", "email"] }
You can match the organization_id
in this response with the ID of the organization you're interested in. Remember to replace $PROJECT_ID
and $WORKSPACE_API_KEY
with your actual project ID and workspace API key when making these requests.