public static void verifyIdTokenCheckRevoked()

in auth/src/main/java/com/google/firebase/quickstart/AuthSnippets.java [212:232]


  public static void verifyIdTokenCheckRevoked(String idToken) throws InterruptedException, ExecutionException {
    // [START verify_id_token_check_revoked]
    try {
      // Verify the ID token while checking if the token is revoked by passing checkRevoked
      // as true.
      boolean checkRevoked = true;
      FirebaseToken decodedToken = FirebaseAuth.getInstance().verifyIdTokenAsync(idToken, checkRevoked).get();
      // Token is valid and not revoked.
      String uid = decodedToken.getUid();
    } catch (ExecutionException e) {
      if (e.getCause() instanceof FirebaseAuthException) {
        FirebaseAuthException authError = (FirebaseAuthException) e.getCause();
        if (authError.getErrorCode().equals("id-token-revoked")) {
          // Token has been revoked. Inform the user to reauthenticate or signOut() the user.
        } else {
          // Token is invalid.
        }
      }
    }
    // [END verify_id_token_check_revoked]
  }