firebase_auth_mocks icon indicating copy to clipboard operation
firebase_auth_mocks copied to clipboard

Added getIdTokenResult support

Open simplecohesion opened this issue 3 years ago • 2 comments

What this PR contains Added support for mocking getIdTokenResult. Most useful for custom claims, which can be used for role-based access control.

  • Adds IdTokenResult? _idTokenResult private property in MockUser
  • Adds IdTokenResult? idTokenResult optional property for MockUser constructor
  • Overrides dart Future<IdTokenResult> getIdTokenResult([bool forceRefresh = false]) in MockUser to return the the _idTokenResult property as a Future value
  • Adds idTokenResult mock data to the test user in firebase_auth_mocks_test.dart

simplecohesion avatar Jun 16 '22 23:06 simplecohesion

Thanks for the PR @simplecohesion. Would you mind writing a unit test as well to show how it works, and prevent others from accidentally breaking your code in the future?

atn832 avatar Jun 30 '22 14:06 atn832

Hey @atn832 , any updates on this?

AngeloAvv avatar Sep 12 '22 11:09 AngeloAvv

Thanks for proposing this PR. I just merged #73 since it came with tests.

atn832 avatar Oct 18 '22 23:10 atn832