diff --git a/README.md b/README.md index 0cfd262f8463e453de00469d5a49082f035429f5..213d962fb6f2663f0e3a90ab6da640da55cda984 100644 --- a/README.md +++ b/README.md @@ -455,6 +455,22 @@ class App extends Component { .catch(error => { //Error while deleting instance id }); + + // Use this functions instead of FCM.getFCMToken if you want revokes access of token + FCM.getEntityFCMToken() + .then(token => { + // Returns a token that authorizes an FCM Entity by Instance ID + // Store fcm token in your server + }) + FCM.deleteEntityFCMToken() + .then( () => { + // Deleted token successfully + // Revokes access to a scope (action) for an entity previously authorized by getToken() with Instance ID + // This will reset token + }) + .catch(error => { + // Error while deleting token + }); } } ``` diff --git a/ios/RNFIRMessaging.m b/ios/RNFIRMessaging.m index bdb05987101093128b12f0286d532405c829c595..629589b442a9a5a7969d4f4a0db79e33be26807d 100644 --- a/ios/RNFIRMessaging.m +++ b/ios/RNFIRMessaging.m @@ -408,6 +408,7 @@ RCT_EXPORT_METHOD(getEntityFCMToken:(RCTPromiseResolveBlock)resolve rejecter:(RC if (deviceToken == nil) { resolve(nil); + return; } [[FIRInstanceID instanceID]tokenWithAuthorizedEntity:entity scope:kFIRInstanceIDScopeFirebaseMessaging options:@{@"apns_token": deviceToken} handler:^(NSString * _Nullable token, NSError * _Nullable error) {