Skip to content

Treat invalid_identity_session token exchange errors as invalid JWT - #1481

Merged
lizkenyon merged 1 commit into
Shopify:mainfrom
jsaubry:js-11-05-token-exchange-invalid-identity-session
Nov 5, 2026
Merged

lizkenyon merged 1 commit into
Shopify:mainfrom
jsaubry:js-11-05-token-exchange-invalid-identity-session

Conversation

@jsaubry

@jsaubry jsaubry commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Treat token exchange’s 400 invalid_identity_session response as ShopifyAPI::Errors::InvalidJwtTokenError, matching the existing handling of invalid_subject_token when the underlying admin session has expired or been logged out. This lets shopify_app return a 401 with X-Shopify-Retry-Invalid-Session-Request (or the bounce page), prompting App Bridge to retry with a fresh session token instead of returning a 500.

Token exchange returns 400 invalid_identity_session when the admin
identity session behind a session token is gone. Raise
InvalidJwtTokenError like invalid_subject_token so apps can retry with
a fresh session token instead of surfacing an HttpResponseError.

Co-authored-by: Claude <noreply@anthropic.com>
@jsaubry
jsaubry marked this pull request as ready for review November 5, 2026 19:08

@lizkenyon lizkenyon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TY

@lizkenyon
lizkenyon merged commit 9b0f71f into Shopify:main Nov 5, 2026
4 checks passed
@Suleimanlatrsh Suleimanlatrsh mentioned this pull request Nov 5, 2026
3 of 4 tasks
@jsaubry
jsaubry deleted the js-11-05-token-exchange-invalid-identity-session branch November 6, 2026 13:29

This branch was successfully deployed

1 active deployment
rubygems — d06738a4 Deployed Nov 6, 2026 by shopify-shipit[bot]
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.

2 participants