Search code examples
oauth-2.0wso2wso2-identity-server

WSO2 federated authenticator with direct login URL


I have an application that uses both Basic Authentication and a custom OAuth 2.0 Federated Authentication using advanced configuration in identity service. I was wondering is there any way to select federated authenticator and not showing login page to the user? is there any direct login URL that redirect users to the federated authenticator? or is there any other way to achieve this by changing Custom Federated Authenticator?

I used Custom OAuth 2.0 Federated Authenticator for this purpose and I can only achieve wanted result by setting identity service Authentication Type to Federated Authentication and by this way I lose access to my Basic Authentication option.


Solution

  • In your created Identity provider, define a value for "Home Realm Identifer".

    enter image description here

    Then access the /oauth2/authorize endpoint with fidp=<home realm identifier value> query param.

    For example:

    https://<IS-HOST>:<IS-PORT>/oauth2/authorize?fidp=<home realm identifer of IDP>&scope=<scopes>&response_type=code&redirect_uri=<callback url>&client_id=<client id of the application>
    

    This will redirect you to the particular federated IDP instead of showing the login page with multi options (basic auth + FIDP). If you want to get the multi-option login page, don't specify the fidp query param.