Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate front- and back-end redirect handling #128

Merged
merged 15 commits into from
Apr 7, 2023

Conversation

jeffdaley
Copy link
Contributor

I think the redirect problem occurs when Ember Simple Auth reports a logged-in user but the back end does not. Here are a couple important logs of a failed attempt:

// the ESA `requireAuthentication` check
[Log] afterModel isLoggedIn – true 

// the API check
[Error] Failed to load resource: the server responded with a status of 401 (Unauthorized)

That error bubbles up to the application route where we invalidate the service. At this point, the app appears to reset, as evidenced by the deprecation warning that usually only appears on appLoad.

CleanShot 2023-04-07 at 11 36 07@2x

I don't have a full grasp of Ember internals, but here's my guess: The app doesn't know what to do after invalidating the session on a protected route, so it just blows itself up. (I'd do the same.) I'm thinking that by adding a redirect back to the auth screen, we might prevent this from happening.

@jeffdaley jeffdaley requested a review from a team as a code owner April 7, 2023 15:41
@anubhavmishra anubhavmishra merged commit 34c5fcc into main Apr 7, 2023
@anubhavmishra anubhavmishra deleted the jeffdaley/redirect-changes branch April 7, 2023 23:00
anuragprafulla pushed a commit to razorpay/hermes that referenced this pull request Jun 27, 2023
* Add console logs

* Add ESA to ember-cli-build

* Fix typo

* Remove unneeded code

* Add additional logs

* Add a try/catch on session setup; Add other logs

* Tweaks

* Clean up logs

* Cleanup

* Add comments

* Cleanup

* Add front-end check

* Add comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants