A JWT verification tool specifically for Firebase Auth JWTs.
Add firebase_auth_admin_verify
as a dependency in your pubspec.yaml file.
import 'package:firebase_auth_admin_verify/firebase_auth_admin_verify.dart';
try {
// **With project id:**
final jwt1 = await verifyFirebaseToken('ey...', projectId: 'my-project-id');
// **With service file at the root:**
final jwt2 = await verifyFirebaseToken('ey...');
// **With service account file:**
final jwt3 = await verifyFirebaseToken('ey...', serviceFilePath: 'path/to/service-account.json');
} catch (e) {
}
For more detailed examples you can check out the example project.