MatanyaP
MatanyaP

Reputation: 476

remove data from Firebase ID token

The data obtained from BaseAuth.verifyIdToken() contains, among other properties, the phone_number and email properties (like detailed here). It can be obtained with DecodedIdToken.phone_number.

What I want to do is hide these fields, so they wouldn't be passed at all in the token. Is there a way to do that? from what I've seen here, you can add data using a custom token, but I couldn't find any information as for the other way around.

thanks!

Upvotes: 0

Views: 279

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598603

The ID token that Firebase Authentication generates contains all information it has for that user. There is no way to hide part of the information from the token.

If you don't want certain properties to be present in the token you should leave them out of the Firebase Authentication profile for that user. For example, you could store them elsewhere, like in one of Firebase's cloud-hosted databases.

Upvotes: 1

Related Questions