问题
I am working on creating some users in my firebase app and I would like to provide custom user ids as they are authenticating with an external service.
For example my user ID generation is consisted by 2 parts like so:
AuthService:AuthServiceUsername
That can look in reality like:
Instragram:dimitrioskanellopoulos
But I dont like to have this string used as a user id so I encode it to base64 like so:
const uid = Buffer.from(`instagram:${serviceUserID}`).toString('base64');
Is there any risk for me doing that ? Is base64 ok to be used also in regards to query params?
回答1:
Firestore document IDs are quite flexible on what's allowed and not. See https://firebase.google.com/docs/firestore/quotas#limits.
But base64 would actually not be safe, since it contains /
, which is disallowed in Firestore document IDs
来源:https://stackoverflow.com/questions/56273672/is-base64-a-good-option-for-encoding-custom-document-ids-for-firestore