Redirecturl issue when directly linking to external authentication

We have created an external authentication provider to Identity Server 3 following the information provided here which is working exactly as required.

We are now looking to automate the login process such that rather than visiting the community login page and clicking on the provider icon beneath the user name/password, users can instead click (for example) a button in the header that will take them direct to the external authentication provider and return them back to the community when logged in (bypassing the out of the box login page).

This all works fine with the exception that it always redirects them to the home page of the community rather than the page that they were viewing, which is obviously the desired result.

I have reviewed the widget ‘User – Login and Create’ which seems to handle this, but I’m struggling to see/understand how to achieve this functionality outside of using that widget and wondered if anyone knew or could advise on how to do so?  It looks as though when the user visits the community user login page, the redirect url is 'remembered' for when control is passed back to the community so that it can redirected but I’m struggling to implement this myself.

Any advice would be great!

  • Some url Apis have the option to specify a return url, I couldn't say which ones off the top of my head, but generally you are seeing the correct behavior.   The redirect is constantly tracked on the server side and in the case its unknown or invalid and needed it will send them to the home page.

    But from it seems like, a third party oauth client is not what you want.  Those are meant to be "additional" logins.  If you want to use a completely different auth process..which results in the existing login to do what you want you need to implement SSO: