Open Niekvan opened 5 years ago
@Niekvan I think this error is caused inside of the JWT parse method as this is the only .replace
call in the SDK ... https://github.com/directus/sdk-js/blob/1e13ca40b6f5f689e28bedb448285c116a542ba6/src/utils/payload.ts#L21-L24
Did you try to add your access token or mail/pass setting like described in https://github.com/directus/sdk-js/blob/develop/recipes/Starter.md ?
Any thoughts on this @rijkvanzanten ? Will this change based on the new auth flow?
I think it's trying to read a non-existent token. It might wrongly assume the token was stored in localStorage, even if it isn't. @benhaynes could be introduced in the typescript refactor or my changes to support cookies
Hi,
I followed the exact instructions in the docs. Using email address and password works fine, but that is not an option for my use case. I fixed it by implementing my own version of the SDK without JWT, as this is not needed for access with the access_token.
🐞 bug report
Description
When using the static access token from the Directus database in the SDK the following error appears:
Uncaught TypeError: Cannot read property 'replace' of undefined
🔬 Minimal Reproduction
🔥 Exception or Error
🌍 Your Environment
SDK Version:
v5.3.4
Anything else relevant? Exact same issue as directus/sdk-js#61 ...