# How to authenticate using the JWT auth method

**URL:** <https://discuss.hashicorp.com/t/how-to-authenticate-using-the-jwt-auth-method/27476>\
**Category:** Consul\
**Created:** [July 29, 2021, 7:37am UTC](https://discuss.hashicorp.com/t/how-to-authenticate-using-the-jwt-auth-method/27476 "2021-07-29T07:37:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric.braun](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/eric.braun/32/17207_2.png) [@eric.braun](https://discuss.hashicorp.com/u/eric.braun)\
**Post date:** [July 29, 2021, 7:37am UTC](https://discuss.hashicorp.com/t/how-to-authenticate-using-the-jwt-auth-method/27476/1 "2021-07-29T07:37:09Z")

</div>

Hey there,

I am trying to figure out how to use the Consul HTTP API using a JWT.  
I have successfully:

- created an auth method with the type “JWT”
- created a binding between a (previously created) role and the auth method
- tested the role using a dedicated token
- used the CLI login command to get a token while providing a valid JWT

However, I would like to use the HTTP API directly with my JWT to authenticate and interact with Consul or get a Consul token using the HTTP API similar to the CLI login command.

Is this even possible? How am I supposed to use the JWT auth method?

Best regards  
Eric

---

<div class="post-metadata">

**Author:** ![mkeeler](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mkeeler/32/721_2.png) [@mkeeler](https://discuss.hashicorp.com/u/mkeeler)\
**Post date:** [July 29, 2021, 1:57pm UTC](https://discuss.hashicorp.com/t/how-to-authenticate-using-the-jwt-auth-method/27476/2 "2021-07-29T13:57:46Z")

</div>

You would use the [login HTTP endpoint](https://www.consul.io/api-docs/acl#login-to-auth-method) to login with your JWT and then use the Consul ACL token that it returns to you for future API calls. When you are done there is also a corresponding [logout endpoint](https://www.consul.io/api-docs/acl#logout-from-auth-method).
