nuxt-auth icon indicating copy to clipboard operation
nuxt-auth copied to clipboard

Basic authentication with no access token in response for local provider

Open idesignzone opened this issue 1 year ago • 1 comments

Describe the feature

The backend I am working with Traccar does not return an access token in the response and token is generated via another request.

How to override token: { signInResponseTokenPointer: '/token/accessToken' }, in this senario for local provider?

How would you implement this?

No response

Additional information

  • [ ] Would you be willing to help implement this feature?

Provider

  • [ ] AuthJS
  • [X] Local
  • [ ] Refresh
  • [ ] New Provider

idesignzone avatar Mar 09 '24 15:03 idesignzone

Hi @idesignzone 👋

If the token is returned in a different format then the current default you can use a json pointer to find it!

// nuxt.config.ts
{
  auth: {
    token: {
      signInResponseTokenPointer: '/get/pointer/here'
    }
  }
}

Read more: https://sidebase.io/nuxt-auth/configuration/nuxt-config

If it is returned via a different url, you may have to look into making a custom api you can call to signin + return the accessToken. You could do this inside the ~/server/api directory.

zoey-kaiser avatar Mar 30 '24 21:03 zoey-kaiser