wso2-identity-server

Organization direct login


I'm new to using SMO2 and I don't know if my question is due to the application's behavior or if I'm doing something wrong.

I have an application that is shared between several organizations, each organization has a different login screen.

I'm using asgardeo/auth-spa in a vuejs application to log in to my SPA, and my configuration is as follows:

await authClient.initialize({
signInRedirectURL: `${window.location.origin}`,
signOutRedirectURL: `${window.location.origin}`,
clientID: ''client-id-', // client_id of the application in the carbon.super organization
baseUrl: 'https://localhost:9443/o/<org-id>',
scope: ['openid', 'profile'],
}); 

When I open the application, I am redirected to the login screen with the error below enter image description here

If I replace the baseUrl value with baseUrl: 'https://localhost:9443/t/carbon.super/o/<org-id>', I am redirected to the old login screen. https://localhost:9443/carbon/admin/login.jsp

enter image description here

And if I leave the baseUrl as baseUrl: 'https://localhost:9443/t/carbon.super', I am redirected to the correct page, but I have to type the name of my organization. What I need is for the user to be directed directly to the organization's login page without having to type the organization's name and then go to the correct login screen.

I appreciate any help that can be given. Thanks


Solution

  • If you need to direct the users to organization login page, /oauth2/authorize call should be initiated with the query params fidp=OrganizationSSO&org=<org-name> or fidp=OrganizationSSO&orgId=<org-id>.

    So, the base URL should be either https://localhost:9443 or https://localhost:9443/t/carbon.super.

    In order to send the query params in the authorize request, we can add the query params as an argument to signIn function in authClient in asgardeo/auth-spa as follows.

    authClient.signIn({fidp: "OrganizationSSO", org: "<org-name>"});
    

    or

    authClient.signIn({fidp: "OrganizationSSO", orgId: "<org-id>"});