Skip to content
Source
Sign inSign up
TanStack/router

Update session not called in WorkOs sample #5021

Send to my agent
Openstefandevo(GitHub profile, opens in a new tab) opened this issue 4 comments

Which project does this relate to?

Start

Describe the bug

Based upon the WorkOS sample, there is a bug where updateSession is never called, hence when the initial token time expires, it's never refreshed with a refresh token.

Your Example Website or App

https://github.com/tanstack/router/tree/main/examples/react/start-workos

Steps to Reproduce the Bug or Issue

updateSession call in the session.ts never called.

Expected behavior

When checking for auth, it should check for valid session and refresh.

@nicknisi as maker of the sample can you elaborate how this should work with refreshing the tokens?

  1. I was wondering why this was the case, this should definitely be updated because it leads new users down a broken path.

  2. Oof yeah, that's not great. We've actually been working on an SDK for TanStack Start and I opened #5394 to update the example to use it, which should fix this issue.

  3. @nicknisi I followed your updated tanstack example and is it expected the middleware does not auto refresh? Seems like the example still has the original issue of not refreshing the token meaning we need to somehow manually do this.

    If so, whats the recommended way? Can that be added to the example PR?

  4. #5394 removed the original custom session implementation and switched the example to the WorkOS SDK. The current middleware does appear to refresh an expired access token and persist the replacement session

    However, the example is still constrained to @workos/authkit-tanstack-react-start ^0.5.0, which predates the subsequent refresh-token fix in workos/authkit-tanstack-start#55. #7430 contains an SDK upgrade, but it has not merged yet.

    I don't think this is ready to close until that upgrade lands and the authenticated token-expiration flow is verified end to end.

Sign in to join this conversation.