Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom headers for refresh call #961

Open
1 of 5 tasks
n0-m4d opened this issue Dec 16, 2024 · 1 comment
Open
1 of 5 tasks

Add custom headers for refresh call #961

n0-m4d opened this issue Dec 16, 2024 · 1 comment
Labels
enhancement An improvement that needs to be added

Comments

@n0-m4d
Copy link

n0-m4d commented Dec 16, 2024

Describe the feature

I'd like to be able to send custom headers when nuxt sends a request to the refresh endpoint.
Why?
Besides sidebase-auth, applications might be protected by Basic Auth (especially during development or staging areas).

Side note:
while /refresh does not send the Basic Auth header i setup for my regular api-calls, /getSession does. not sure why.

Would this be of interest? Or is there already a way to achieve this (besides configuring web server setup)?

How would you implement this?

Something like this would be sufficient, although a hook/callback might be more flexible:

// nuxt.config.ts
[...]
refresh: {
        isEnabled: true,
        endpoint: { 
          path: 'refresh', 
          method: 'POST', 
          headers: {
            'Authorization': 'Basic Yml0asFkZW46a3VuZGVuY2VqdGVy',
          }, 
        },
[...]

(I replaced the default token.headerName with another header name).

Additional information

  • Would you be willing to help implement this feature?

Provider

  • AuthJS
  • Local
  • Refresh
  • New Provider
@n0-m4d n0-m4d added enhancement An improvement that needs to be added pending An issue waiting for triage labels Dec 16, 2024
@phoenix-ru phoenix-ru removed the pending An issue waiting for triage label Dec 19, 2024
@phoenix-ru
Copy link
Collaborator

Hi @n0-m4d , adding hooks for all the methods has been a feature many people anticipate and I personally want to implement.

I did an initial prototype a couple months ago already and wasn't satisfied by it. I would definitely come back to it in the next year, probably for the next minor release even if nothing else pops up 🙂

I created #964 to gather all the usecases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement that needs to be added
Projects
None yet
Development

No branches or pull requests

2 participants