How do I use JWT with grpc?
<p>I am trying to get my head wrapped around <a href="http://www.grpc.io/docs/guides/auth.html#using-client-side-ssltls" rel="nofollow">grpc authentication</a>. From the looks of the examples, it looks like grpc supports ssl/tls and google tokens...</p>

<p>I've also looked at <a href="https://jwt.io/" rel="nofollow">json web tokens</a> as a means of authentication.</p>

<p>I'm not sure if this is even the correct way of thinking about this, but how would I use JWT in conjunction with grpc?</p>

<p>Is the JWT the "token" that gets used with the oauth2 example?</p>

<p>Does it relate to the 'roots.pem' file that is being opened?</p>

<p>I feel like I know very little about authentication/tokens. I've tried searching for python examples that involve grpc and JWT, and it has been a mostly fruitless search.</p>

<p>Am I thinking about this the wrong way?</p>

<p>The normal JWT approach uses service account credentials which are provided by the environment in a well-known location. This is what "Google Default Credentials" are in the examples. These are by far the easiest to get working, and have the best security and performance characteristics.</p>

<p>OAuth2 is also supported, by using a OAuth token. This is useful for things like 3-legged OAuth or integrating into a pre-existing application that is using tokens directly.</p>

<p><code>roots.pem</code> is something different. That's for TLS-based authentication with custom Certificate Authorities.</p>

<p>That said, there is currently no JWT example in Python. Please follow <a href="https://github.com/grpc/grpc/issues/6860" rel="nofollow">the open issue</a>. The example today uses service account credentials, but then converts it to a normal OAuth token.</p>

python authentication token jwt grpc