akveo / ngx-admin

Customizable admin dashboard template based on Angular 10+
https://akveo.github.io/ngx-admin/
MIT License
25.19k stars 7.94k forks source link

[Question ] Nebular / Auth #1701

Closed Amentino9090 closed 5 years ago

Amentino9090 commented 6 years ago

hi I'm trying to have a nebular auth in my application When i finished to config a my provider (fake response) have this exception in console after login.

TypeError: Object(...) is not a function at NbTokenService.setRaw (token.service.js:76) at NbAuthService.processResultToken (auth.service.js:346) at SwitchMapSubscriber.eval [as project] (auth.service.js:119) at SwitchMapSubscriber._next (switchMap.js:91)

This is my appmodule


 NbAuthModule.forRoot({
      providers: {
        email: {
          service: NbEmailPassAuthProvider,
          config: {
            baseEndpoint: 'http://localhost:4200/assets/data',
            login: {
              alwaysFail: false,
              rememberMe: true,
              endpoint: '/login.json',
              method: 'get',
              redirect: {
                success: '/home',
                failure: null,
              },
              defaultErrors: ['Login/Email combination is not correct, please try again.'],
              defaultMessages: ['You have been successfully logged in.'],
            },

          },
        },
      },
    forms: {
      login: {
        strategy: 'email',

       },
    }
  }),

thanks a lot M

RodrigoPauletti commented 6 years ago

+1

For me, the error is:

core.js:1449 ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function
TypeError: Object(...) is not a function
    at NbTokenService.webpackJsonp../node_modules/@nebular/auth/services/token/token.service.js.NbTokenService.get (token.service.js:90)
nnixaa commented 6 years ago

Hi Guys, could you post a reproducible example to http://stackblitz.com?

RodrigoPauletti commented 6 years ago

I try to use http://stackblitz.com but this error appears: We currently only support projects scaffolded with @angular/cli.

alvaroinckot commented 6 years ago

+1

Configured NbEmailPassAuthProvider with the default setup: https://akveo.github.io/nebular/?utm_source=github&utm_medium=nebular_readme#/docs/auth/nbemailpassauthprovider

Got this:

ERROR TypeError: Object(...) is not a function
    at NbTokenService.setRaw (token.service.js:74)

Looking into the token.service.js, 74 line:

 return observableOf(null);

Seems the import observableOf import { BehaviorSubject, of as observableOf } from 'rxjs'; are null; But I don't have idea why

Node version: 8.9.4

@nnixaa This description could help to fix it?

janabimustafa commented 6 years ago

+1 on this issue. I have a fork of ngx-admin that I just tried upgrading to v2.1.1 and I am experiencing the same exact issue.

core.js:1449 ERROR TypeError: Object(...) is not a function
    at NbTokenService.setRaw (token.service.js:74)
    at NbAuthService.processResultToken (auth.service.js:342)
    at SwitchMapSubscriber.eval [as project] (auth.service.js:116)
    at SwitchMapSubscriber._next (switchMap.js:91)
    at SwitchMapSubscriber.Subscriber.next (Subscriber.js:95)
    at CatchSubscriber.Subscriber._next (Subscriber.js:131)
    at CatchSubscriber.Subscriber.next (Subscriber.js:95)
    at MapSubscriber._next (map.js:85)
    at MapSubscriber.Subscriber.next (Subscriber.js:95)
    at MapSubscriber._next (map.js:85)
nnixaa commented 6 years ago

Still very hard to tell, have you updated npm modules accordingly?