Skip to content

Commit

Permalink
Merge pull request #1491 from OneSignal/identity_verification_works_w…
Browse files Browse the repository at this point in the history
…ith_prod

[JWT] Handle when jwt_required is not returned in remote params
  • Loading branch information
nan-li authored Oct 5, 2024
2 parents 1fbddcf + 57c6f08 commit facb589
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,20 @@ extension OneSignalUserManagerImpl {
jwtConfig.isRequired = required
}

/**
This is called when remote params does not return the property `IOS_JWT_REQUIRED`.
It is likely this feature is not enabled for the app, so we will assume it is off.
However, don't overwrite the value if this has already been set.
*/
@objc
public func remoteParamsReturnedUnknownRequiresUserAuth() {
guard jwtConfig.isRequired == nil else {
return
}
OneSignalLog.onesignalLog(.LL_DEBUG, message: "remoteParamsReturnedUnknownRequiresUserAuth called")
jwtConfig.isRequired = false
}

@objc
public func subscribeToJwtConfig(_ listener: OSUserJwtConfigListener, key: String) {
jwtConfig.subscribe(listener, key: key)
Expand Down
3 changes: 3 additions & 0 deletions iOS_SDK/OneSignalSDK/Source/OneSignal.m
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,9 @@ + (void)downloadIOSParamsWithAppId:(NSString *)appId {
[OneSignalCoreImpl.sharedClient executeRequest:[OSRequestGetIosParams withUserId:userId appId:appId] onSuccess:^(NSDictionary *result) {
if (result[IOS_JWT_REQUIRED]) {
OneSignalUserManagerImpl.sharedInstance.requiresUserAuth = [result[IOS_JWT_REQUIRED] boolValue];
} else {
// Remote params did not return IOS_JWT_REQUIRED
[OneSignalUserManagerImpl.sharedInstance remoteParamsReturnedUnknownRequiresUserAuth];
}

if (result[IOS_USES_PROVISIONAL_AUTHORIZATION] != (id)[NSNull null]) {
Expand Down

0 comments on commit facb589

Please sign in to comment.