Login Action - api.access.deny and api.redirect.sendUserTo Looping after Call
Last Updated:
Overview
This article addresses the issue of an infinite redirect loop encountered when implementing custom login actions for "Sign In with Google" functionality. Specifically, it examines the scenario where a custom action is designed to validate email invitations and deny access to uninvited users, leading to an unintended and persistent redirection loop.
Applies To
- api.access.deny
- api.redirect.sendUserTo
- Action
Cause
The looping occurs because the user has a valid, active session with Google.
- A login attempt triggers the custom Action.
- The Action redirects the user to the application's login endpoint.
- The application's login endpoint initiates an
/authorizecall, specifying the Google social connection. - The
/authorizecall immediately redirects the user to Google. - Google already has a valid user session.
- Google's valid session triggers the Action pipeline again.
- The Action pipeline results in a failed login (due to the email validation).
- The Action redirects the user back to the application's login endpoint, restarting the loop from step 3.
Solution
Before navigating to their application's login endpoint, first make a federated logout call to Google so that this user can go through the login flow again, breaking the loop.