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
[SDK] Authentication arguments inconsistency #22193
Comments
Some good points of inconsistencies that have cropped up over time. A small disclaimer the linked docs pages under "API reference" were written for the API not the SDK and while they have a lot of overlap if there are conflicting defaults we have no good place to document that currently.
|
Describe the Bug
Currently the Authentication via SDK has some inconsistencies. To be more precise the issue is with both operation arguments as well as defaults used for each one (for now I can confirm with
rest
, but alsoauth
isn't clear):Description
I'll separate the Rest description form the Auth questions
Rest
login
:Code defaults to
cookie
(as it should)directus/sdk/src/rest/commands/auth/login.ts
Line 24 in 75c03bd
While docs say
json
Screenshot
logout
andrefresh
Both correctly defaults to
cookie
, no docs info (assumingjson
as login), but also the order of the arguments is inconsistent.Which comes first, the chicken or the egg?
Also the
body: JSON.stringify(....)
is inconsistent, causing potential developer error in making therefresh
work, but not thelogout
(and vice versa).directus/sdk/src/rest/commands/auth/logout.ts
Lines 12 to 18 in 75c03bd
directus/sdk/src/rest/commands/auth/refresh.ts
Lines 12 to 21 in 75c03bd
Auth
login
'smode
vslogout
andrefresh
In the auth's
login
the mode can be manually overwritten, but what would be the advantage if it cannot be also overwritten forlogout
andrefresh
? Wouldn't this cause inability for neither refreshing nor invalidating user's sessions if the developer erroneously edited the mode during login?login
:directus/sdk/src/auth/composable.ts
Line 131 in 75c03bd
logout
:directus/sdk/src/auth/composable.ts
Line 167 in 75c03bd
refresh
:directus/sdk/src/auth/composable.ts
Line 103 in 75c03bd
To Reproduce
These issues were original discussed inside the
nuxt-directus
#254 issue. But only now confirmed as I finally have noticed my error in the order of arguments forrefresh
andlogout
, and documentation declaring a different default.Directus Version
v10.10.5
Hosting Strategy
Self-Hosted (Docker Image)
The text was updated successfully, but these errors were encountered: