Skip to content

Only uid, but no custom claims or context.auth.token in functions.auth.user().onDelete() when using custom token #822

Closed
@mortlun

Description

@mortlun

Related issues

[REQUIRED] Version info

node:

node version : 10

firebase-functions:
3.12

firebase-tools:
8.16.2

firebase-admin:
9.3.0

[REQUIRED] Test case

Create custom token with claims
const claims = {test:"test"}; const uid = 123; admin.auth().createCustomToken(uid, claims);

delete user (this is dart code)
final currentUser = await FirebaseAuth.instance.currentUser(); await currentUser.delete();

trigger:
exports.deleteUserData = functions.auth.user().onDelete((userRecord, context) => { console.log(userRecord.customClaims); console.log(context.auth.token); });

[REQUIRED] Steps to reproduce

  1. create a custom token with claims.
  2. Login using the custom token.
  3. After login with custom token, delete user with flutter client sdk.
  4. Check function logs and see that customClaims is empty.

[REQUIRED] Expected behavior

context.auth.token
and
userRecord.customClaims

should not be undefined or empty, but contain the claims of the deleted user.

[REQUIRED] Actual behavior

email: null, emailVerified: false, displayName: null, photoURL: null, phoneNumber: null, disabled: false, providerData: [], customClaims: {}, passwordSalt: null, passwordHash: null, tokensValidAfterTime: null, uid: '10659670',

Were you able to successfully deploy your functions?

No error messages

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions