Firebase Dart Admin Auth SDK
  • Firebase Dart Admin Auth SDK
    • Introduction
    • Getting Started
      • Installation
      • Initialize Firebase
    • User Management
      • Create User With Email and Password
      • Update Current User
      • Sign In With Credential
      • Sign In With Custom Token
      • Sign in with Email Link
      • Sign In Anonymously
      • Sign Out
      • Sign In With Redirect
      • Sign In With Popup
      • Sign in with Phone Number
      • Sign In With Email and Password
    • User Profile & Data
      • Update Profile
      • Get ID Token
      • Get ID Token Result
      • Reload user
      • Delete User
    • Email & Password Actions
      • Apply Action Code
      • Send Email Verification
      • Send Password Reset Email
      • Update Password
      • Verify Before Update Email
      • Verify Password Reset Code
      • Send Password Reset Email
      • Send Sign-in Link To Email
      • Confirm Password Reset
      • Check Action Code
    • Authentication State
      • Before Auth State Changed
      • On ID Token Changed
      • On Auth State Changed
    • Credential Management
      • Is Sign In With Email Link
      • Unlink Provider
      • Link With Credential
      • Fetch Sign In Methods For Email
      • Link With Popup
      • Link With Phone Number
    • Initialization & Configuration
      • Set Persistence
      • Connect Emulator
      • Use Device Language
      • Set Language Code
      • Initialize Recaptcha Config
      • Get Auth
      • Initialize Auth
    • Multi-Factor Authentication
      • Get Multi-Factor Resolver
    • OAuth and Third-party Auth
      • Generate Custom Token
      • Get Redirect Result
      • Revoke Access Token
    • Utility Functions
      • Get Additional User Info
      • Parse Action Code URL
    • Examples and Tutorials
    • Contributing
    • FAQs
Powered by GitBook
On this page
  1. Firebase Dart Admin Auth SDK
  2. OAuth and Third-party Auth

Revoke Access Token

To enforce security in your application, you can use the revoke access token feature to revoke a user's access token. This functionality comes in handy when you want a user to get a new ID token before they can perform the next set of operations.

Here is how it can be used:

Implementation

Call the auth.revokeAccessToken() method to revoke a particular user's access as seen below:

  try {
    // Revoke access token
    await auth.revokeAccessToken();
    print("Access token revoked successfully.");
  } catch (e) {
    print("Error revoking access token: $e");
  }

After creating the FirebaseAuth instance auth, access its .revokeAccessToken() method to trigger the revocation of the current user's ID token.

This would log them out of the application to enforce another login before subsequent operations can be done.

PreviousGet Redirect ResultNextUtility Functions

Last updated 11 months ago