1

i'm using nebular auth for my angular app, i want to add token when user login to header here's the API response

{
  "status": 0,
  "message": null,
  "data": {
    "type": "bearer",
    "token": "string"
  }
}

And in my auth.module

NbAuthModule.forRoot({
      strategies: [
        NbPasswordAuthStrategy.setup({
          name: 'email',
          token: {
            class: NbAuthJWTToken,
            key: 'data.token', 
          },
          baseEndpoint: 'http://api.mydomain.com/api',
          login: {
            redirect: {
              success: '/pages/project/all-project',
              failure: null
            },
            endpoint: '/login',
            method: 'post',
          },
          register: {
            endpoint: '/register',
            method: 'post',
          },
          logout: {
            endpoint: '/auth/sign-out',
            method: 'post',
          },
          requestPass: {
            endpoint: '/auth/request-pass',
            method: 'post',
          },
          resetPass: {
            endpoint: '/auth/reset-pass',
            method: 'post',
          },
        }),
      ],
      forms: {},
    }),

I succesfully logged in but there is no token in header, how can i add that when user login?

naoval
  • 338
  • 6
  • 29

0 Answers0