This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Directus SDK refresh auto not working. #9639
Comments
Also, what value has your |
I'm setting up the SDK by:
I am then doing:
(Updated based on your link, auto-refresh is on by default, but the problem still persists) I am fetching items by:
My
|
Thank you @TomS- Also, can you make the same requests using the API endpoints? |
It seems to be something with your server because the SDK or any JS side has access to cookies. So, since you are no cookie set I believe there's some misconfiguration. |
Just found an interesting scenario but it is totally expected. This can leads to unexpected behaviours like cookie not be present, because both will share the cookie. const sdk = new Directus("http://localhost:8055", { auth: { mode: 'json' } }); Although this is not advised on browsers. Check here why: https://docs.directus.io/reference/sdk/#options.auth Testing on anonymous tab seems to work as expected, since you not login into admin. |
"Set-Cookie header was blocked due to user prefernces." Interestingly I haven't changed any of my preferences in Chrome. So I tried Firefox, and while Firefox doesn't report an error, it doesn't set the cookie either. EDIT: https://samesite-sandbox.glitch.me/ Could be something to do with LetsEncrypt. EDIT 2: Interestingly this issue has only just started appearing however. I have no idea why it started but it seems to co-inside with a server side update I had with aaPanel. EDIT 3:
I now have cookies successfully setting, but not in Incognito Mode. Which is expected: I wonder if it's worth setting the defaults to this in future updates? I am also interested why others haven't had this issue, unless they knew this and I'm an idiot (most likely the case). EDIT 4:
|
Are you running on |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Preflight Checklist
Describe the Bug
Since updating the 9.0.0 I'm having issues with login persisting. For the login function I am doing:
However, I get the following error after some time:
In previous versions I would be kept logged in and the token would auto refresh as expected.
To Reproduce
Use the Javascript SDK and use
{ refresh: { auto: true } }
the token will not auto refresh.Errors Shown
What version of Directus are you using?
9.0.0
What version of Node.js are you using?
14.17.6
What database are you using?
MySQL 5.7
What browser are you using?
Chrome
What operating system are you using?
Windows
How are you deploying Directus?
Digital Ocean
The text was updated successfully, but these errors were encountered: