Fix/use fresh tokens#1627
Conversation
…hToken to be deparacated
Co-authored-by: Peter Pistorius <[email protected]>
|
Update: repro'd the test issue https://s.tape.sh/WIyxZqox |
…h-tokens * 'main' of github.com:redwoodjs/redwood: Move whatwg-fetch from devDep to dep Adds mockCurrentUser() to api-side jest v0.22.1 v0.22.0 Revert "Configure ApolloProvider to always use fresh tokens (redwoodjs#1609)" (redwoodjs#1611) Configure ApolloProvider to always use fresh tokens (redwoodjs#1609) Ignore *.scenarios.* files. (redwoodjs#1607) upgrade prisma v2.12.1 (redwoodjs#1604) Test Scenarios (redwoodjs#1465) Use relative path to config stories location (redwoodjs#1509)
…fix/use-fresh-tokens * 'fix/use-fresh-tokens' of github.com:dac09/redwood:
a1e9711 to
7307ad3
Compare
|
Added extra checks, before calling getToken. e2e tests now pass https://s.tape.sh/UOJM6MYf ✅ |
|
Thanks for giving this another go @dac09 🚀 Release NotesInclude Deprecation Warning:
|
|
@peterp handing over to you for review + merge |
| const { getToken, type: authProviderType, isAuthenticated } = useAuth() | ||
|
|
||
| const withToken = setContext(async () => { | ||
| if (isAuthenticated && getToken) { |
There was a problem hiding this comment.
Is there a case when getToken would be falsy?
There was a problem hiding this comment.
This was causing the failure in the e2e test. Its falsy when you're not logged in - wasn't sure if there's any other case where its falsy apart from the first render of the auth provider.
There was a problem hiding this comment.
getToken is falsey? But surely that shouldn't be the case since the function is provided via the provider? Maybe one of the "fake implementations" doesn't follow the providers spec.
|
@peterp bumping this, responded to your comments :) |
Co-authored-by: Peter Pistorius <[email protected]>
Creating this PR again repeat of #1609.
New tasks:
getTokenis not found error for apps without Auth