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

Distinguishing an unsuccessful OAuth flow #2313

Closed
rxb opened this issue Apr 22, 2021 · 1 comment
Closed

Distinguishing an unsuccessful OAuth flow #2313

rxb opened this issue Apr 22, 2021 · 1 comment

Comments

@rxb
Copy link

rxb commented Apr 22, 2021

Steps to reproduce

  • a feathersjs backend and a react (web) frontend using feathersjs/client for authentication
  • using feathersjs/authentication-local
  • using feathersjs/authentication-oauth (google, in this case)
  • calling .reAuthenticate() on frontend init to either:
    • read token saved in localstorage or
    • get oauth accessToken from location.hash
    • get oauth error from location.hash

Actual behavior

Currently, the feathers client throws a 401 not-authenticated for both...

  • when reAuthenticate does not find a token in localstorage (normal occurrence for every pageload for a non-logged-in user)
  • when reAuthenticate captures an OAuth error from the location.hash, returning from an oauth flow

Expected behavior

It would be useful if there was a way to distinguish the OAuth failure error specifically (for example: an Oauth attempts to create a user that fails validation because the email already exists as a local-auth user ) and show the user some helpful info for logging in to their original account with email/password.

It's also very possible I'm thinking about this in completely the wrong way and there's a simpler way to detect a bad OAuth on the client. Thanks so much for your help!

Module versions (especially the part that's not working):
5.0.0-pre.3

NodeJS version:
14.15.0

Operating System:
MacOS 11.3

Browser Version:
Chrome 90.0.4430.61

@rxb rxb changed the title Distinguishing an unsuccessful OAuth flow from simple failed reAuthenticate from localstorage Distinguishing an unsuccessful OAuth flow Apr 22, 2021
@daffl daffl added this to the v5 (Dove) milestone Sep 16, 2022
@daffl
Copy link
Member

daffl commented Nov 25, 2022

I just realised that this has been addressed a while ago in #2189

@daffl daffl closed this as completed Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants