Any other way to authenticate user without redirecting to session/sso

We have implemented SSO using DiscourseConnect, also we are providing anonymous access 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.
Is there any way to authenticate the user whenever he is reaching forums?
We tried using session/sso method but, if the authentication fails user is redirected to home page but, we need the user to reach the return path.