* Add a tip explaining HTTP Only cookies issue
Watching the Discord, I see this issue coming up fairly frequently, when someone is developing a front end app locally, and their app suddenly stops working with the message
> Error: "refresh_token" is required in either the JSON payload or Cookie
This tip explains the cause of the issue, and two different workarounds.
* use relative link
Co-authored-by: Azri Kahar <azrikahar@outlook.com>
* refactor: more intuitive interfaces
* refactor: simpler refresh
before: on every request we were debouncing a refresh request
after: call refresh only once before now() + 'expires'
* refactor: prefix on base storage
* fixup! refactor: simpler refresh before: on every request we were debouncing a refresh request after: call refresh only once before now() + 'expires'
* refactor: simpler axios transport
before: handle auth headers
after: auth headers are handled on directus instance
* refactor: simpler usage of Directus constructor
* fixup! refactor: simpler refresh before: on every request we were debouncing a refresh request after: call refresh only once before now() + 'expires'
* refactor: fix tests based on previous changes
* refactor: better auth constructor
before: depends on SDK instance
after: depends on Transport and Storage instance
* accept staticToken from auth
* make transport and storage as optional on options
* fix type auth refresh
* simplify transport
* fix test for previous changes
* improve auth class
* revert some IAuth props because tests
* allow to force memory of localstorage on storage
* add tests for previous change
* document everything and simplify some things
* fix override headers on request
* better name typing
* fix private axios
* removed boolean from CLI auth.refresh()
* fix missing url in some examples
* soem grammar updates
Co-authored-by: Jay Cammarano <jay.cammarano@gmail.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
* Change confusing statement about storage adapter
Mainly used to store auth token / expiration
Refresh tokens only in JSON mode
* Remove 'time' option in 1st example since described in 2nd example
* Add infos about options.refresh on Auth