sidebase / nuxt-auth

Authentication built for Nuxt 3! Easily add authentication via OAuth providers, credentials or Email Magic URLs!
https://auth.sidebase.io
MIT License
1.3k stars 165 forks source link

Custom refresh response token pointer #895

Open Rizzato95 opened 2 months ago

Rizzato95 commented 2 months ago

Describe the feature

Hi,

I'm using the module in local mode pointing to an external api (to which I don't have access and cannot edit). During sign in the token comes in bearerToken property:

{
  ...
  "bearerToken": "my-token",
}

But during refresh the token comes in accessToken property:

{
  ...
  "accessToken": "my-token",
}

In the configuration I set signInResponseTokenPointer to /bearerToken who works like a charm during SignIn but returns an error during refresh:

image

This happens because the module uses signInResponseTokenPointer to retrieve the token also during the refresh call.

What I need is a configuration property like refreshResponseTokenPointer to allow the token to be handled correctly when provided in different properties between calls.

Thanks

Provider

phoenix-ru commented 1 month ago

Hi @Rizzato95 , thanks for your request. As we're a bit busy at the moment with higher priority issues, would you give it a try yourself? We would be able to quickly review your PR

N1K1TAS95 commented 1 month ago

Same problem here. I'm coming from version 0.7.2, where there was that option. I've also opened an issue #635 and it was fixed #727.

Rizzato95 commented 1 month ago

Same problem here. I'm coming from version 0.7.2, where there was that option. I've also opened an issue #635 and it was fixed #727.

I think we're not talking about the same problem. You asked for an option in the refresh request (which is now present as you correctly say), I need it in the refresh response.

I created a PR (#910) for this new option.

N1K1TAS95 commented 1 month ago

@Rizzato95 ops 😅. You’re right, my bad.