Skip to content

feat: add token refresh via @assembly-js/app-bridge#1148

Open
foleyatwork wants to merge 1 commit intofeature/client-associationfrom
feature/app-bridge-token-refresh
Open

feat: add token refresh via @assembly-js/app-bridge#1148
foleyatwork wants to merge 1 commit intofeature/client-associationfrom
feature/app-bridge-token-refresh

Conversation

@foleyatwork
Copy link
Contributor

@foleyatwork foleyatwork commented Mar 2, 2026

Kevin's Notes:
I forgot to add the app bridge last time, hopefully this solves any expiring token issues.

Eventually you guys can replace all your postMessages with function calls from this new package.


AI Description:

Summary

  • Adds @assembly-js/app-bridge (v1.1.0) to subscribe to automatic token refresh events from the parent Copilot dashboard
  • Creates useTokenRefresh hook that configures the bridge with the portal URL and dispatches updated tokens to Redux
  • Wires the hook into ClientSideStateUpdate so it runs on every page

Test plan

  • npx tsc --noEmit passes with no type errors
  • In browser dev tools, verify the postMessage listener is active after page load
  • When the parent dashboard sends a sessionToken.update message, confirm Redux state taskBoard.token updates

🤖 Generated with Claude Code

Subscribe to automatic token refresh events from the parent Copilot
dashboard so API calls don't fail when tokens expire mid-session.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment on lines +21 to +23
const unsubscribe = AssemblyBridge.sessionToken.onTokenUpdate((data) => {
store.dispatch(setToken(data.token))
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@foleyatwork Assuming a long user session, does onTokenUpdate fire events for multiple token refreshes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it's a pretty self-explanatory implementation, any time the frame receives a new token that callback is fired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants