-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use hardcoded JWT token in AppleAppStoreBridge #4803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Replaces the dynamic extraction of the JWT token from the page meta tag with a hardcoded token, as the previous method stopped working. The token is sourced from Apple's own JavaScript and is valid until January 26, 2026.
Pull request artifacts
last change: Sunday 2025-11-16 13:59:24 |
Removed the getJWTToken() method and inlined the hardcoded JWT token directly into getAppData(). Updated HTTP headers for API requests to better mimic browser behavior and improve compatibility.
Replaced the hardcoded JWT token and its reference to the latest version from Apple's JavaScript source.
|
Without knowing the technical details here, I dislike hardcoding a credential like that. Is there a reasonable way to extract constantly fresh JWT tokens from another Apple page? How is the app store webpage doing it? |
|
You’re absolutely right, hardcoding a credential like this isn’t ideal, and I dislike it too. The problem is that this JWT isn’t issued dynamically: Apple actually embeds it directly in the JavaScript bundle of the App Store webpage, as a constant: const TQ = "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlU4UlRZVjVaRFMifQ.eyJpc3MiOiI3TktaMlZQNDhaIiwiaWF0IjoxNzYyOTkwMTA3LCJleHAiOjE3NzAyNDc3MDcsInJvb3RfaHR0cHNfb3JpZ2luIjpbImFwcGxlLmNvbSJdfQ.IrZxlIHsZBiBLZPw1UZYkyqwbPDPmzcj8U57M3w252i3A4TRzASKx2aGAoXJ0WtuNihmyyopREeVqpJlpjq0fw";So the bridge isn’t really "spoofing" anything, it’s just using the exact token that Apple’s own frontend uses. The issue is that this token changes whenever Apple rebuilds the web app, meaning the asset filename changes (e.g. Unfortunately, I’m not familiar enough with PHP to implement that cleanly myself. For now, the only workaround I can offer is keeping the token updated when I notice it changes, but that obviously isn’t ideal for you either, since it would require merging PRs every time Apple pushes a new build. If you know a better approach or if someone more experienced in PHP wants to help with scraping the token dynamically, that would definitely be the long-term fix. (I can implement that in Python if needed) |
|
I used an IA to implement the JWT extraction. Please review my code before merging it. See my new PR: #4824. Sorry, I don't know much about PHP. |
* Use hardcoded JWT token in AppleAppStoreBridge Replaces the dynamic extraction of the JWT token from the page meta tag with a hardcoded token, as the previous method stopped working. The token is sourced from Apple's own JavaScript and is valid until January 26, 2026. * Refactor AppleAppStoreBridge to simplify token handling Removed the getJWTToken() method and inlined the hardcoded JWT token directly into getAppData(). Updated HTTP headers for API requests to better mimic browser behavior and improve compatibility. * Split long JWT token string for readability * Fix long JWT token string concatenation style * Disable and re-enable PHPCS rule for token assignment * Update hardcoded Apple App Store token Replaced the hardcoded JWT token and its reference to the latest version from Apple's JavaScript source.
* Use hardcoded JWT token in AppleAppStoreBridge Replaces the dynamic extraction of the JWT token from the page meta tag with a hardcoded token, as the previous method stopped working. The token is sourced from Apple's own JavaScript and is valid until January 26, 2026. * Refactor AppleAppStoreBridge to simplify token handling Removed the getJWTToken() method and inlined the hardcoded JWT token directly into getAppData(). Updated HTTP headers for API requests to better mimic browser behavior and improve compatibility. * Split long JWT token string for readability * Fix long JWT token string concatenation style * Disable and re-enable PHPCS rule for token assignment * Update hardcoded Apple App Store token Replaced the hardcoded JWT token and its reference to the latest version from Apple's JavaScript source.
* Use hardcoded JWT token in AppleAppStoreBridge Replaces the dynamic extraction of the JWT token from the page meta tag with a hardcoded token, as the previous method stopped working. The token is sourced from Apple's own JavaScript and is valid until January 26, 2026. * Refactor AppleAppStoreBridge to simplify token handling Removed the getJWTToken() method and inlined the hardcoded JWT token directly into getAppData(). Updated HTTP headers for API requests to better mimic browser behavior and improve compatibility. * Split long JWT token string for readability * Fix long JWT token string concatenation style * Disable and re-enable PHPCS rule for token assignment * Update hardcoded Apple App Store token Replaced the hardcoded JWT token and its reference to the latest version from Apple's JavaScript source.
Replaces the dynamic extraction of the JWT token from the page meta tag with a hardcoded token, as the previous method stopped working. The token is sourced from Apple's own JavaScript and is valid until January 26, 2026.