-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement creation of custom token #150
Comments
I think this is out of scope right now since that functionality is actually:
In case you want to generate a token yourself the crate supports custom JSON tokens via: Let me know if you have a specific case where this is somehow required for Firestore and |
I will provide some more context and hopefully that will be helpful. We have client applications using the Firebase client libraries to generate auth tokens for each user and the client applications are invoking our Rust backend http services and sending the Firebase auth tokens in the header of the request. We have custom Rust code that is responsible for validating the bearer auth token. I modeled this Rust verification code from this Go code: https://github.com/firebase/firebase-admin-go/blob/master/auth/token_verifier.go#L156 If you know of a similar Rust implementation that is already written, please let me know. |
Thanks for the details. Let me contemplate on this a bit. I think this probably will need to update Google Cloud SDK first, since it is not flexible enough right now to provide the required token. |
Thank you. I have some example Go code I am using along with some Rust validation code that I can provide if needed. |
I made some draft implementation here #152 so you can provide your own token source (or static token value if you want). Left an example:
Can you check it with your tokens? PS In case you're not aware, you can point your code directly at my feature branch on github: |
I pulled in the feature branch and I am having a bit of trouble because the function
|
Also in my code, |
Ok, let me return those :) I didn't know that they actually used by anyone. |
I am going through the Rust example and it is requiring
|
Unfortunately, this can't be cloneable anymore since it accepts Box<> which is not cloneable, so you will need to fix that part of the code on your side. |
I understand regarding |
I've returned back
Looking at your links, this part is inside Firebase/Auth-related libraries (outside of Firestore). Looking at the official documentation though https://firebase.google.com/docs/auth/admin/create-custom-tokens#create_custom_tokens_using_a_third-party_jwt_library |
Thank you for returning the |
It is probably closer to Also if you are able to provide some kind of implementation of some of the functions for Identitytoolkit v1 would be beneficial for others I think :) |
I understand. I don't know if I have the time or experience to do a proper implementation of the IdentityToolkit v1. I really wish Google would just provide a properly supported Gcloud SDK for Rust similar to AWS Rust SDK. |
I agree, I would prefer not to support Google SDKs myself indeed. Regarding Identity toolkit, just to be clear, I just suggested separating it into a new module available for others so people can add missing functions themselves in one place. There is no need to create full functional since we don't have Open API spec available or protobufs. |
Could you please provide some clarity for me on the tokens generated by |
For reference for anyone who reads this issue later, below is working Rust code to generate signed Firebase tokens:
|
Can you go ahead and merge in the |
Glad to see that you have a working version now 👍🏻 |
Let me know if you still have any issues or additional questions. Closing this for now. |
Implement functionality in Rust: CustomToken creates a signed custom authentication token with the specified user ID.
See Go reference code:
https://pkg.go.dev/firebase.google.com/go/[email protected]/auth#Client.CustomToken
The text was updated successfully, but these errors were encountered: