Firebase Storage Rules with Custom Claims

前端 未结 3 1841
既然无缘
既然无缘 2021-01-15 11:05

I am unable to get Firebase Storage work with custom rules and using custom claims.

In my Python Admin panel, I do the following to create the user and assign a clai

3条回答
  •  既然无缘
    2021-01-15 11:35

    For completeness, one need to create a token before setting the token for the user.

    Thus full code:

    uid = 'some-uid'
    additional_claims = {
        'client_id': your_custom_client_id
    }
    
    # First time, only once needed
    custom_token = auth.create_custom_token(uid, additional_claims)
    
    # Then
    auth.set_custom_user_claims(uid, additional_claims )
    

提交回复
热议问题