Skip to content

Custom claims for functions.auth.user().onDelete is a string #126

@rhodgkins

Description

@rhodgkins

Version info

firebase-functions: 0.7.1

firebase-tools: 3.13.1

firebase-admin: 5.4.2

Test case

Deploy the following firebase-functions:

const functions = require('firebase-functions')
const admin = require('firebase-admin')

exports.onUserCreated = functions.auth.user().onCreate(event => {
    return admin.auth().setCustomUserClaims(event.data.uid, { hello: 'world' })
})

exports.onUserDeleted = functions.auth.user().onDelete(event => {
    const { customClaims } = event.data
    console.log(`Custom claims (type=${typeof customClaims}):`, customClaims)
    return Promise.resolve()
})

Steps to reproduce

Create a user in Firebase and then view the Cloud function logs.

Were you able to successfully deploy your functions?

Yes

Expected behavior

The customClaims should be an object as per the admin.auth.UserRecord

Custom claims (type=object): { hello: 'world' }

Actual behavior

The customClaims is a string and (it is also not listed on functions.auth.UserRecord docs).

Custom claims (type=string): {"hello": "world"}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions