Repository navigation
feat: Project ID naming; the JWT provider restores a signed session after a restart; version 19.5.0 - #63
Merged
Conversation
…fter a restart; version 19.5.0 Project ID: the key Gleap.initialize takes is now called the Project ID in the Javadoc, README, sample app and log lines. The signature and the value are unchanged (Gleap.initialize(String projectId, Application)), so every existing key keeps working. Identity: setUserJwt keeps the token in memory only, so after an app restart on a Signed project the SDK had the session but no token, and a provider set with setUserJwtProvider was never asked; the user stayed unsigned. When the session answer says identity.mode "signed" without a grant for an identified session, no token or user hash is at hand and a provider is set, the provider is now asked once per app start and its token goes through setUserJwt (the one signed identify of the session). The provider's guards apply, a null token sends nothing, a logout or an identify of the app while it runs drops the token, and setUserJwtProvider after the session answer runs the same check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 7, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the Project ID contract (7 Nov 2026) for Android and ports the identity fix from GleapSDK/JavaScript-SDK#208.
1. "SDK key" is now "Project ID"
Gleap.initialize(String projectId, Application application): same signature and value, so every existing key keeps working. Only the parameter name and the Javadoc changed. There are no publicsdkKey/apiKeysetters or config objects (GleapConfigis package-private), so no new methods were needed.MainApplication) and log lines say "Project ID". TheApi-Tokenheader, theapiKeyWebSocket query parameter and thesdkKeyfield sent to the widget are wire names and stay as they are.2. The JWT provider restores a signed session after an app restart
The gap existed.
setUserJwtkeeps the token in memory only. After an app restart on a Signed project, the SDK held the session (and maybe a grant the server no longer accepts) but no token. When/sessionsansweredidentity: { mode: "signed", signed: false }, the existing held-identify path only re-sent a stored legacy user hash or an identify the app had already passed in. A provider set withsetUserJwtProviderwas only asked when a token expired, so the user stayed unsigned.Fix (
GleapSessionController.identifyWithProviderForSignedModeIfNeeded, called after the/sessionsanswer inGleapBaseSessionServiceand fromsetUserJwtProvider). The provider is asked once per app start (signedModeProviderAsked, reset inclearUserSession) when all of these hold:signedGrantMissing:identity.mode == "signed", a user id, no grant, no signed identify sent for this session yet)lastIdentifyhash, no stored legacy hash)The token goes through
Gleap.setUserJwt, the normal path.claimSignedGrantRequestmakes that identify the one signed identify of the session, so there is never a loop. Other behaviour:nulltoken sends nothing.identity_mismatchrecovery.setUserJwtProvidercalled after the session answer runs the same check, so the provider works whether it is set before or afterGleap.initialize.Gleap,iGleap), README and CHANGELOG describe the new behaviour.Tests
New
SignedModeProviderRestoreTest, 10 tests:nulltoken sends nothing and the provider is not asked againWith the fix disabled, the 5 positive tests fail. The other 5 cover the guards and pass either way.
How it was run. There is no JDK 17–23 on this machine, only Android Studio's JBR 25, which Gradle 8.10.2 cannot run on. So
./gradlew testcould not run. Instead, the main and test sources were compiled with JBR 25javacagainst the SDK'sandroid.jar(android-37) plus:R/BuildConfigThe tests then ran with plain JUnit 4 against:
android.jar(method bodies replaced with default returns, like AGP'sunitTests.returnDefaultValues = true)org.jsonbuilt from the SDK's android-37 sourcesResult: all 260 unit tests pass (36 classes), including the 10 new ones. CI (
./gradlew :gleap:testDebugUnitTest :gleap:assembleRelease) is the authoritative run.Versioning
VERSION_NAMEis 19.5.0 (VERSION_CODE195000) andCHANGELOG.mdhas a## 19.5.0section. This is a minor bump to stay in sync with iOS 19.5.0, which addsinitialize(withProjectId:). Nothing is tagged or published to Maven Central.For the wrapper SDKs
Gleap.initialize(String, Application)is unchanged and works with old and new native versions.nullon failure, and work whether it is set before or after initialize.🤖 Generated with Claude Code