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

[Question]: Logging in with an existing token #1742

Open
RakouskyS opened this issue Apr 21, 2023 · 0 comments
Open

[Question]: Logging in with an existing token #1742

RakouskyS opened this issue Apr 21, 2023 · 0 comments
Labels

Comments

@RakouskyS
Copy link

RakouskyS commented Apr 21, 2023

What Version of the library are you using?
15.0.3

Question
I am using a CefSharp browser, which gets an accesstoken. I send this to my angular frontend.

How can I login with this token, which I have already gotten?
I need this for refreshing, logging out, having the cookie in my localstorage etc.

My normal login using authorization code flow looks like this

public callbackSetup() {
    this.oidcSecurityService.checkAuth()?.subscribe(({ isAuthenticated, userData, accessToken, idToken }) => {
      if (!isAuthenticated) {
        return;
      }

      const mappedRoles = this.getMappedRolesAndCheckIfUserHasRightsToLogin(accessToken);

      if (mappedRoles.length < 1)
        return;

      this.userService.setUserData(userData, accessToken, idToken, mappedRoles);
      this.router.navigate(['entrypoint']);
    });
  }

I am looking for a similar solution like this:

public callbackSetupWithToken(accessToken: string) {
    this.oidcSecurityService.authorizeWithExistingToken(accessToken);
    const mappedRoles = this.getMappedRolesAndCheckIfUserHasRightsToLogin(accessToken);

      if (mappedRoles.length < 1)
        return;

      this.userService.setUserData(......);
      this.router.navigate(['entrypoint']);
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant