# How to use Oauth2 plugin with JWT tokens?

**URL:** <https://discuss.konghq.com/t/how-to-use-oauth2-plugin-with-jwt-tokens/6648>\
**Category:** Questions\
**Created:** [July 2, 2020, 8:32am UTC](https://discuss.konghq.com/t/how-to-use-oauth2-plugin-with-jwt-tokens/6648 "2020-07-02T08:32:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skpuri](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/skpuri/32/2061_2.png) [@Skpuri](https://discuss.konghq.com/u/Skpuri)\
**Post date:** [July 2, 2020, 8:32am UTC](https://discuss.konghq.com/t/how-to-use-oauth2-plugin-with-jwt-tokens/6648/1 "2020-07-02T08:32:09Z")

</div>

Our project has decided to introduce an API gateway and we going with Kong. I am trying to add **oauth2** plugin to a service that i have created in kong but i am not able to understand its flow when using authorization code flow.  
Also does oauth2 plugin support **JWT tokens** if yes how can we implement it? If it does not support JWT tokens then how can we create our own plugin?  
Also how is oauth2 plugin verifying the generated tokens ?

---

<div class="post-metadata">

**Author:** ![rucciva](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/rucciva/32/1391_2.png) [@rucciva](https://discuss.konghq.com/u/rucciva)\
**Post date:** [December 11, 2020, 10:16am UTC](https://discuss.konghq.com/t/how-to-use-oauth2-plugin-with-jwt-tokens/6648/2 "2020-12-11T10:16:37Z")

</div>

Hi, if you have existing OAuth2 provider, you can use [custom plugin](https://github.com/TelkomIndonesia/kong-plugin-oauth2-audience) that i’ve made to authenticate with it. Or just use it as reference for developing custom kong plugin.
