Sending Firebase auth token over gRPC (Dart)

510 views
Skip to first unread message

Matt Stagitis

unread,
Mar 9, 2021, 6:19:57 PM3/9/21
to grpc.io
Hi all,

I am working on a Flutter application that allows users to sign in via Google and Facebook using Firebase. After signing in, a user get's an auth token from Firebase. I'd like to send this auth token alongside each gRPC call so the server can authenticate the signed in user.

Is there a recommended approach for doing so from a Dart gRPC client (the Flutter app)? I've dug around the docs and haven't found much, other than manually writing the auth token to the request's metadata (not sure if this is the right way to go).

Thanks ahead of time!

- Matt

Sanjay Pujare

unread,
Mar 9, 2021, 7:37:23 PM3/9/21
to Matt Stagitis, grpc.io

You can use CallOptions to set auth credentials (for example, GCE credentials or JWT credentials) when a service requires them.

Have you looked into using CallOptions?


--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/f2919f4c-2cba-4021-8eab-294f7bfd5bc8n%40googlegroups.com.

Matt Stagitis

unread,
Mar 9, 2021, 9:49:19 PM3/9/21
to Sanjay Pujare, grpc.io
Hey Sanjay,

Thanks for the response. Yup, that's where I see that I can add any data I want in the metadata map. I just wanted to double check that this was the recommended approach.

Thanks for pointing me to this doc.

- Matt
Reply all
Reply to author
Forward
0 new messages