Skip to content
This repository was archived by the owner on Mar 3, 2022. It is now read-only.
This repository was archived by the owner on Mar 3, 2022. It is now read-only.

UserManager.signinRedirect() returns a resolved promise even when the redirection isn't finalized #1363

Open
@Lautaro-Garcia

Description

@Lautaro-Garcia

Hello! Thank you for mantaining this library, I've been using it for some time now, and yesterday I found a case that I wasn't expecting. I don't know if it's the desired use case for that API. If it is, ignore this issue.

So, if I use the UserManager#signinRedirect() method to start the sign-in process it returns a resolved promise, allowing code that's hooked up in a .then() method to run even when the page will eventually change to the login page:

async foo() {
  await userManager.signinRedirect();
  console.log('something');  // <- This may run, depending on how quickly the browser changes pages
}

I expected that signinRedirect() would stop the execution flow (because the user will be redirected to a new URL). Wouldn't it be better if it returned a pending promise, so if the library user awaits the redirection it won't keep executing things? I wrote this as a question, because maybe you implemented this in that way to support another feature that I'm not using 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions