# Help with OAuth2 Basic plugin

**URL:** https://meta.discourse.org/t/help-with-oauth2-basic-plugin/238163
**Category:** Support
**Created:** [September 5, 2022, 3:10pm UTC](https://meta.discourse.org/t/help-with-oauth2-basic-plugin/238163 "2022-09-05T15:10:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![qlands](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/qlands/32/272758_2.png) [@qlands](https://meta.discourse.org/u/qlands)
#### Post date: [September 5, 2022, 3:10pm UTC](https://meta.discourse.org/t/help-with-oauth2-basic-plugin/238163/1 "2022-09-05T15:10:56Z")

</div>

I installed and configured the OAuth2 Basic plugin with our App but I get the following error and I don’t know what is going on:

```plaintext
OAuth2 Debugging: request POST https://formshare.ngrok.io/oauth2/token

Headers: {"User-Agent"=>"Faraday v1.9.3", "Content-Type"=>"application/x-www-form-urlencoded", "Authorization"=>"Basic S2k2SFZtTVpuSTFHUExiRXVlWVJDNENiOkNvb1k0anlQemt3dWNRV21Sa2FWOVNnbHZLbjJFT3cxc3BIMmtMck9yY21vNDM4Tg=="}

Body: {"client_id"=>"Ki6HVmMZnI1GPLbEueYRC4Cb", "client_secret"=>"some_secret", "grant_type"=>"authorization_code", "code"=>"MsWr5INPAYgq9HneriXG4R4ga1rK0lCU3giAMlVTXNQwcW8O", :redirect_uri=>"https://community.formshare.org/auth/oauth2_basic/callback"}

------------------

OAuth2 Debugging: response status 200

From POST https://formshare.ngrok.io/oauth2/token

Headers: {"content-length"=>"239", "content-type"=>"text/html; charset=UTF-8", "date"=>"Mon, 05 Sep 2022 12:56:12 GMT", "ngrok-trace-id"=>"5a6a53d01f2291f686e1cb6944528cc5", "server"=>"gunicorn"}

Body: {"token": {"token_type": "Bearer", "access_token": "freVOb8cHFofdiK58WDFxDhpiVizQpxDdTYypZckOE", "expires_in": 864000}, "header": [["Content-Type", "application/json"], ["Cache-Control", "no-store"], ["Pragma", "no-cache"]], "status": 200}

-----------------------------------
(oauth2_basic) Authentication failure! invalid_credentials: OAuth2::Error, {"token": {"token_type": "Bearer", "access_token": "freVOb8cHFofdiK58WDFxDhpiVizQpxDdTYypZckOE", "expires_in": 864000}, "header": [["Content-Type", "application/json"], ["Cache-Control", "no-store"], ["Pragma", "no-cache"]], "status": 200}

```

Our app uses OAuth2 with Response type = code . It uses Python authlib to produce all OAuth2 results. Is the plugin expecting something else as part of the token response?

---

<div class="post-metadata">

### Author: ![qlands](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/qlands/32/272758_2.png) [@qlands](https://meta.discourse.org/u/qlands)
#### Post date: [September 9, 2022, 10:52am UTC](https://meta.discourse.org/t/help-with-oauth2-basic-plugin/238163/2 "2022-09-09T10:52:22Z")

</div>

I managed to fix this problem. The issue was that our OAuth2 App was returning the token as “text/html; charset=UTF-8” and had to be “application/json”

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 9, 2022, 10:52am UTC](https://meta.discourse.org/t/help-with-oauth2-basic-plugin/238163/3 "2022-10-09T10:52:45Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
