Switch user organization with out re-login in asp.net Core

I am encountering an issue during a silent login attempt, despite having provided all the relevant information. An error is still being returned.

var client = new RestClient($"{_options.Domain}/authorize?response_type=id_token token&client_id={_options.ClientId}&redirect_uri=https://localhost:44304&state=STATE&scope=openid profile email offline_access&nonce={nonce}&audience={_options.Audience}&response_mode=form_post&prompt=none&organization={organisatoinId}");

Furthermore, the return status code is “OK,” but upon inspecting the content, an error is displayed in HTML format. This is contradictory to the documentation, which clearly states that a redirect URL should be returned instead.

<html><head><title>Submit This Form</title><meta http-equiv="X-UA-Compatible" content="IE=edge"></head><body onload="javascript:document.forms[0].submit()"><form method="post" action="https://localhost:44304"><input type="hidden" name="error" value="login_required"/><input type="hidden" name="error_description" value="Login required"/><input type="hidden" name="state" value="STATE"/></form></body></html>

Hi @ahtashamkamal223344

Thanks for getting in touch with us at Auth0 Community.

I think the issue here could be your use of RestSharp. The /authorize endpoint needs to be redirected to as it is an interactive endpoint, this will then fire our hosted Universal Login page.

Have you seen our quickstarts on how you might implement this e.g. https://auth0.com/docs/quickstart/webapp/aspnet-core

There are some organization specific examples here too https://github.com/auth0/auth0-aspnetcore-authentication/blob/main/EXAMPLES.md#organizations

Warm regards.

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