gRPC supports several built-in authentication mechanisms:
- SSL/TLS: Used to authenticate the server and encrypt data. Supports mutual authentication (mTLS) where clients provide certificates.
- ALTS (Application Layer Transport Security): A transport security mechanism available when running on Google Compute Engine or Google Kubernetes Engine (GKE).
- Token-based authentication with Google: A mechanism to attach metadata-based credentials (like OAuth2 tokens) to requests.
Important Security Note: Google credentials should only be used to connect to Google services. Sending a Google-issued OAuth2 token to a non-Google service risks token theft and impersonation.
Token-based authentication must be used in conjunction with SSL/TLS, as most implementations require an encrypted channel to send credentials.