akveo / nebular

:boom: Customizable Angular UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/nebular
MIT License
8.06k stars 1.51k forks source link

Auth refresh token, not being passed? #933

Closed Platiplus closed 6 years ago

Platiplus commented 6 years ago

Issue type

I'm submitting a ... (check one with "x")

Issue description

Current behavior: Can't find the token on the request using the refresh token method. On my API, I call console.log(request); and I cant't find the token anywhere.

Expected behavior: Check if user is authenticated on auth guards and if it is, pass the current token and refresh it, so the session expires after X minutes when IDLE.

Steps to reproduce: Using the starter kit from ngx-admin with auth modules already set on place, create a simple auth-guard as explained in the tutorial and try to call the refresh token method.

Related code:

  canActivate() {
    return this.authService.isAuthenticated()
      .pipe(
        tap(authenticated => {
          if (!authenticated) {
            this.router.navigate(['auth/login']);
          } else {
            this.authService.getToken().subscribe((value) => {
              this.authService.refreshToken('email', { token: value['token'] }).subscribe((message) => {
                console.log(message)
              });
            });
          }
        }),
      );
  }

Other information:

Angular, Nebular

"@nebular/auth": "2.0.0-rc.9",
"@angular/core": "6.0.0"
"name": "ngx-admin",
"version": "2.3.0",
Platiplus commented 6 years ago

I found the problem on the code in the auth.service.js on @nebular auth service. I've created a pull request, but it's my first time doing so, any help would be appreciated.

@nnixaa fixed this problem with #935, can you lend me a hand?

nnixaa commented 6 years ago

Hey @Platiplus, this is fixed in the master branch, you just need to update to the latest Nebular version.

Platiplus commented 6 years ago

Hey @Platiplus, this is fixed in the master branch, you just need to update to the latest Nebular version.

Yeah, I saw it, but this version is the version you guys ship with the ngx-admin starter-kit. Are you considering to update the version that comes with the starter kit or fixing the bug on this version?