Skip to content

Adding headers to endpoint requests #838

@AidosMarcos

Description

@AidosMarcos

Context

using nuxt-auth with local external provider and my external API demans an 'ApiKey' header to authorize any request to be made.
So far i was unable to find a way to had custom header to the endpoints defined in nuxt-auth config, Is there any way to do this?

Already tried creating plugin trying to "catch" fetch request and manually add header but does not seem to work with fetch call made by nuxt-auth.

Describe the feature

Possibility to add request headers to defined endpoints.

How would you implement this?

Add another prop do the object that defines endpoint like:

endpoints: { signIn: { path: 'login', method: 'post', headers: { ... } }, signOut: { path: 'logout', method: 'post', headers: { ... } }, signUp: { path: 'register', method: 'post', headers: { ... } }, getSession: { path: 'session', method: 'get', headers: { ... } }, }

Additional information

  • Would you be willing to help implement this feature?

Provider

  • AuthJS
  • Local
  • Refresh
  • New Provider

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn improvement that needs to be addedp2Nice to have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions