Skip to main content
The RadarVerifiedDelegate protocol provides client-side delivery of verified location tokens. Implement this delegate to receive tokens containing verified location data and fraud detection results.
Always verify tokens server-side using your secret key before trusting the location data.

Protocol Declaration

protocol RadarVerifiedDelegate
@protocol RadarVerifiedDelegate<NSObject>

Delegate Methods

didUpdateToken

Tells the delegate that the current user’s verified location was updated. Verify the token server-side using your secret key.
optional func didUpdateToken(_ token: RadarVerifiedLocationToken)
- (void)didUpdateToken:(RadarVerifiedLocationToken *_Nonnull)token;
token
RadarVerifiedLocationToken
required
The verified location token containing user data, events, fraud detection results, and a signed JWT.

Usage

Setting the Delegate

import RadarSDK

class MyLocationManager: RadarVerifiedDelegate {
    
    init() {
        // Set the verified delegate
        Radar.setVerifiedDelegate(self)
    }
    
    func didUpdateToken(_ token: RadarVerifiedLocationToken) {
        // Handle the verified location token
        if token.passed {
            print("User passed verification")
            
            // Send token to your server for verification
            if let jwtToken = token.token {
                sendTokenToServer(jwtToken)
            }
        } else {
            print("User failed verification")
            
            // Check failure reasons
            if let reasons = token.failureReasons {
                print("Failure reasons: \(reasons)")
            }
        }
    }
    
    private func sendTokenToServer(_ token: String) {
        // Send token to your server for server-side verification
        // using your Radar secret key
    }
}
#import <RadarSDK/RadarSDK.h>

@interface MyLocationManager : NSObject <RadarVerifiedDelegate>
@end

@implementation MyLocationManager

- (instancetype)init {
    self = [super init];
    if (self) {
        // Set the verified delegate
        [Radar setVerifiedDelegate:self];
    }
    return self;
}

- (void)didUpdateToken:(RadarVerifiedLocationToken *)token {
    // Handle the verified location token
    if (token.passed) {
        NSLog(@"User passed verification");
        
        // Send token to your server for verification
        if (token.token) {
            [self sendTokenToServer:token.token];
        }
    } else {
        NSLog(@"User failed verification");
        
        // Check failure reasons
        if (token.failureReasons) {
            NSLog(@"Failure reasons: %@", token.failureReasons);
        }
    }
}

- (void)sendTokenToServer:(NSString *)token {
    // Send token to your server for server-side verification
    // using your Radar secret key
}

@end

Using with Verified Tracking

The RadarVerifiedDelegate only receives tokens when using verified tracking methods. Standard tracking methods will not trigger this delegate.
// Start verified tracking
Radar.startTrackingVerified()

// Or use verified foreground tracking
Radar.trackVerified { (status, location, events, user, token) in
    // Token is also delivered via the completion handler
    if let token = token {
        print("Received token in completion handler")
    }
}
// Start verified tracking
[Radar startTrackingVerified];

// Or use verified foreground tracking
[Radar trackVerifiedWithCompletionHandler:^(RadarStatus status, 
                                           CLLocation *location, 
                                           NSArray<RadarEvent *> *events, 
                                           RadarUser *user,
                                           RadarVerifiedLocationToken *token) {
    // Token is also delivered via the completion handler
    if (token) {
        NSLog(@"Received token in completion handler");
    }
}];

Server-Side Verification

After receiving a token via the delegate, send it to your server for verification:

See Also

Build docs developers (and LLMs) love