0

I'm using ngx-admin theme to create a custom signin (ngx-admin uses nebular's auth component to generate a signin page, check the documentation here), Here's the code to setup the authentication stratergy

   ...NbAuthModule.forRoot({
    strategies: [
      NbPasswordAuthStrategy.setup({
        name: 'email',
        baseEndpoint: 'http://localhost:57700',
        login: {
          endpoint: '/token',
          method: 'post',
        },
      }),
    ],
    forms: {
      login: {
        strategy: 'email',
      },
    },
  }).providers,

while I was able to set up the initial signin page and was successful in making the api call to my backend server, but my backend server expects the api call to be of content-type application/x-www-form-urlencoded, and NbPasswordAuthStrategy uses application/json by default.

I've searched all around the documentation given but i'm not able to find any solution for customizing the header for the requests that NbAuthModule makes using NbPasswordAuthStrategy.

PS: I know this issue can be solved using interceptors, but I'm refraining to implement an interceptor for just one api call.

Justice
  • 422
  • 2
  • 8
  • 21

1 Answers1

1

Unfortunately, for the time being, interceptors are the only way to go, the strategy doesn't set any headers on request (source). There is a feature request. Contributions are always welcome : )

yggg
  • 106
  • 3