SSO failover scenarios


we are using discourse as a forums tool.
We have implemented SSO using DiscourseConnect, also we are providing anonymous access as well for the users.
User can be able to land inside discourse using multiple ways (Links in pages or in the navigation).
Whenever clicking those links users are redirected to forums but they are not logged in.
After some research we found that, adding session/sso to the url will trigger the authentication and adding a return path will redirect the user to the return path. But if the user is not logged in whenever we try to do the above technique user is getting redirected to home page and not the actual return path.
Is there any way to redirect the user to return path if not authenticated or sso fails.

Appreciate the help.