mirror of
https://github.com/google/app-check
synced 2026-11-11 22:15:53 +05:45
Add generation of limited-use tokens with a TTL of 5 mins (#11)
This commit is contained in:
1 parent
2b623874c9
commit
8d0bdd3f24
20 files changed
+482
-144
No files matched your search
@@ -101,11 +101,24 @@ static NSString *const kDebugTokenUserDefaultsKey = @"FIRAAppCheckDebugToken";
|
||||
|
||||
- (void)getTokenWithCompletion:(void (^)(GACAppCheckToken *_Nullable token,
|
||||
NSError *_Nullable error))handler {
|
||||
[self getTokenWithLimitedUse:NO completion:handler];
|
||||
}
|
||||
|
||||
- (void)getLimitedUseTokenWithCompletion:(void (^)(GACAppCheckToken *_Nullable,
|
||||
NSError *_Nullable))handler {
|
||||
[self getTokenWithLimitedUse:YES completion:handler];
|
||||
}
|
||||
|
||||
#pragma mark - Internal
|
||||
|
||||
- (void)getTokenWithLimitedUse:(BOOL)limitedUse
|
||||
completion:(void (^)(GACAppCheckToken *_Nullable token,
|
||||
NSError *_Nullable error))handler {
|
||||
[FBLPromise do:^NSString * {
|
||||
return [self currentDebugToken];
|
||||
}]
|
||||
.then(^FBLPromise<GACAppCheckToken *> *(NSString *debugToken) {
|
||||
return [self.APIService appCheckTokenWithDebugToken:debugToken];
|
||||
return [self.APIService appCheckTokenWithDebugToken:debugToken limitedUse:limitedUse];
|
||||
})
|
||||
.then(^id(GACAppCheckToken *appCheckToken) {
|
||||
handler(appCheckToken, nil);
|
||||
|
||||
Reference in new issue
Block a user