-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
Unify local
and refresh
provider
#821
Comments
@phoenix-ru, I am currently debating how to detect if the
In addition, we need to decide how to handle the missing returns of
This method and value will also be typed for
This feels like the most "native" solution and would properly reflect to developers why the two are not working. |
I would suggest a simpler solution (Option 2 in your case): have a flag {
type: 'local',
refresh: {
isEnabled: true,
onlyToken: true,
token: { }
}
} What do you think? Of course, feel free to come up with better namings/organization Regarding nuxt-auth/src/runtime/types.ts Lines 482 to 490 in 429b615
I think this is fine. In summary: I can see both advantages and disadvantages of merging the providers. The biggest disadvantage to me so far is that we have a (imho) great TS setup to separate the two and provide type hints. The quality of hints will get lower and we would need to add |
* updated types to match new refresh / local provider logic * removed playground for refresh provider, began updating useAuthState logic for local to handle refresh tokens * finished merging local and refresh providers * removed tests for refresh playground * change the tsconfig to inherit the local playground tsconfig * fix: types * Apply suggestions from code review * fix: remove refresh test ci * fix: improve signOut body composition * added remark about refeshToken being null if refresh.isEnabled is false * Also added jsdoc for internal UseAuthReturn type * Added types for refresh cookie httpOnly flag and improved JSDocs for it * updated outdated doc links * improve jsdocs on refreshOnlyToken * fix: build * chore: minor adjustments * removed left over package.json * enh: use json pointer for signout request --------- Co-authored-by: Marsel Shayhin <18054980+phoenix-ru@users.noreply.github.com> Co-authored-by: Marsel Shaikhin <phoenix.apps@yahoo.com>
Describe the feature
The current
local
andrefresh
providers share many of the same logic, aside from therefresh
provider having an additional endpoint that lets you refresh the session.Maintaining both providers separately, although they share a lot of the same logic has lead to some inconsistencies between the two. With the release of 1.0.0 we plan to unify the two providers, enabling the additional logic of the
refresh
provider by checking ifendpoint.refresh
was set. If it was, then the logic of the refresh provider is enabled, otherwise thelocal
provider remains as it currently is.Provider
The text was updated successfully, but these errors were encountered: