# Response code: 401

**URL:** <https://www.patreondevelopers.com/t/response-code-401/2845>\
**Category:** Wordpress Plugin\
**Created:** [March 6, 2020, 10:16am UTC](https://www.patreondevelopers.com/t/response-code-401/2845 "2020-03-06T10:16:26Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [April 2, 2020, 9:22pm UTC](https://www.patreondevelopers.com/t/response-code-401/2845/21 "2020-04-02T21:22:13Z")

</div>

That shows its updated at least - thats a major improvement.

Please try this procedure:

- In connection settings tab, delete every field and save settings.

- Make sure there is no registered app in register clients page at Patreon for that particular site

- Make sure you are logged into the relevant creator account at Patreon

- Try using the Connect button in Patreon Settings page.

If this fails, there’s something decisively amiss with your site’s connection.

---

<div class="post-metadata">

**Author:** ![Venus](https://avatars.discourse-cdn.com/v4/letter/v/35a633/32.png) [@Venus](https://www.patreondevelopers.com/u/Venus)\
**Post date:** [April 4, 2020, 8:06am UTC](https://www.patreondevelopers.com/t/response-code-401/2845/22 "2020-04-04T08:06:14Z")

</div>

I’m having the same problems with WP on my site. My patrons can’t access the Patreon only content. Various error messages. I have the most up to date version of the plugin and using V2. I have tried disconnecting using the settings in the plugin, only to get the same unable to disconnect message. Finally able to manually disonnect it from Patreon. Deleted the plugin. Started over, and still getting the same problems.

---

<div class="post-metadata">

**Author:** ![ESL\_Brains](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/esl_brains/32/941_2.png) [@ESL\_Brains](https://www.patreondevelopers.com/u/ESL_Brains)\
**Post date:** [April 5, 2020, 7:13pm UTC](https://www.patreondevelopers.com/t/response-code-401/2845/23 "2020-04-05T19:13:36Z")

</div>

Ok, I followed your procedure and got reconnected. I tested that on my staging environment. After that, I went through the process to test if everything is okay and I potentially found what’s throwing those “invalid\_grant” errors.

Bear with me as I explain how I used Patreon plugin and maybe you’ll be able to help me fix it.

I created a [sign up](https://eslbrains.com/sign-up/) page. On that page I have my Patreon Tiers explained and 3 sign up buttons:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/patreondevelopers/original/2X/9/942d891ab7db4d43107f656513c4fc0f1b8f20b3.png)  
I wanted these buttons to work just as the Become a Patron buttons that put users directly into the Patreon checkout process. But I additionally wanted users to be redirected to a Thank You Page (actually to 3 different thank you pages so I could track the conversion). I couldn’t figure out how to do the redirection - there is only this in the Become a Patreon link:  
`redirect_uri=https%3A%2F%2Feslbrains.com%2Fpatreon-authorization%2F&state=`  
so no exact parameter (at least for me) to point where a user should be redirected.

So I came up with an (ugly) hack :). I generated a “Become a Patron” button on those Thank You Pages, copied the links and put those links in the buttons on my sign up page. Obviously, I removed those Become a Patron buttons from my Thank You Pages. When I tested it on my staging everything worked perfectly, i.e I could use the buttons on my sign up page, go through the checkout and then get redirected to a thank you page on my site and be automatically logged in.

Now, when I was testing the sign up process after reconnecting my staging environment according to your procedure, I found out that the process works up to the point of logging into my website, i.e. I could use the button on the sign up page, create account and get redirected to a Thank You page but I wasn’t automatically logged in (even though I click “allow” on the screen below).  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/patreondevelopers/original/2X/9/91716d652d0967fed58d95b9264db80f6d33691b.png)

Instead when I got redirected to the Thank You Page I get this in URL:  
`http://test.eslbrains.com/thank-you5/?patreon_message=patreon_cant_login_api_error&patreon_error=invalid_grant`

This only happens when using the buttons on my sign up page. Everything works okay when I use the Become a Patron button on any post with locked content:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/patreondevelopers/original/2X/4/43d899634078b7caf7510faf6012f5e5cab3f6d9.png)

So the above happens now on my staging environment. Just to test I created 2 accounts to be sure. I figured that’s why I have errors on my production environment but when I tested the process on my production env today, it worked perfectly. I tested it only with one of the buttons because otherwise I’d have to create 2 more accounts.

_Side note: It’s ridiculous and frustrating that we can’t have some tests users as creators and instead I need to pledge and create dummy users tied to my credit card account any time I want to test something_

Now, my question is why I’m getting this “invalid\_grant” errors on production. I hope my explanations helped clarify the case. I can only suspect that one of those 3 sign up buttons is throwing this error (I just tested one of them on production). I can test that if necessary but I don’t get new Patrons every 5 mins and my logs look like that:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/patreondevelopers/original/2X/5/5b799ad3fac2212be2ccee4e70b3a2327a9f4398.png)

All in all, I’d like to know why I see those errors and how my users are affected by it 🙂 Oz, help 🙂

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [April 6, 2020, 6:28pm UTC](https://www.patreondevelopers.com/t/response-code-401/2845/24 "2020-04-06T18:28:57Z")

</div>

What is the specific error or issue that you are getting when connecting your site?

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [April 6, 2020, 6:37pm UTC](https://www.patreondevelopers.com/t/response-code-401/2845/25 "2020-04-06T18:37:49Z")

</div>

Users must not be immediately redirected to thank you page when they return - they must be redirected to patreon-authorization page.

The final redirect can be put into final\_redirect\_uri parameter in state variable array and then sent to Patreon after being json\_encode -\> base64\_encode -\> urlencode in that order.

---

<div class="post-metadata">

**Author:** ![crinacle](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/crinacle/32/1040_2.png) [@crinacle](https://www.patreondevelopers.com/u/crinacle)\
**Post date:** [December 1, 2021, 4:05pm UTC](https://www.patreondevelopers.com/t/response-code-401/2845/26 "2021-12-01T16:05:21Z")

</div>

Reviving this thread as I’ve been getting this problem as well all of a sudden.

WP 5.8.2 with PHP 7.4.26  
Patreon WordPress 1.7.9 with API v2

The errors on the health check page:

```auto
**0.01 days ago**

Response code: 401 Response :{"error": "invalid_grant"}

**0.01 days ago**

fetch_user - API v2 Class - UUID 54cdca51-7d77-4aa4-9877-5b940b8d7182 - Response code: 401 Response :{"errors":[{"code":1,"code_name":"Unauthorized","detail":"The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.","id":"54cdca51-7d77-4aa4-9877-5b940b8d7182","status":"401","title":"Unauthorized"}]}

**0.01 days ago**

Response code: 401 Response :{"error": "invalid_grant"}

**0.01 days ago**

fetch_creator_info - API v2 Class - UUID 1be35fa5-c7e5-4305-857c-9b3b928475cf - Response code: 401 Response :{"errors":[{"code":1,"code_name":"Unauthorized","detail":"The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.","id":"1be35fa5-c7e5-4305-857c-9b3b928475cf","status":"401","title":"Unauthorized"}]}

**0.01 days ago**

Response code: 401 Response :{"error": "invalid_grant"}

**0.01 days ago**

fetch_creator_info - API v2 Class - UUID 40fa2374-848e-4f70-a736-6c24a8d6a8cb - Response code: 401 Response :{"errors":[{"code":1,"code_name":"Unauthorized","detail":"The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.","id":"40fa2374-848e-4f70-a736-6c24a8d6a8cb","status":"401","title":"Unauthorized"}]}

**0.01 days ago**

Response code: 401 Response :{"error": "invalid_grant"}

**0.01 days ago**

fetch_creator_info - API v2 Class - UUID 0931818f-1546-4aaa-b124-5e229fef3890 - Response code: 401 Response :{"errors":[{"code":1,"code_name":"Unauthorized","detail":"The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.","id":"0931818f-1546-4aaa-b124-5e229fef3890","status":"401","title":"Unauthorized"}]}

```

Same deal as the OP, deleted the API, re-created, reconnected, API was upgraded from V1 to V2 but still nothing. Deleted the plugin entirely and also nothing. Did a rollback to previous versions and nothing. No new plugins have been installed during the time this problem started occurring. Cloudflare _is_ used on this site but it also has been since its creation, so I don’t think caching is the problem either.

Note that the plugin has been working near-flawlessly for the last two years or so, so this is the biggest hiccup thus far. Patrons are unable to log in to view gated content at all, and I’ve exhausted almost all options at this point…

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [December 3, 2021, 1:44pm UTC](https://www.patreondevelopers.com/t/response-code-401/2845/27 "2021-12-03T13:44:43Z")

</div>

Does this still continue to happen as of this moment?

---

<div class="post-metadata">

**Author:** ![crinacle](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/crinacle/32/1040_2.png) [@crinacle](https://www.patreondevelopers.com/u/crinacle)\
**Post date:** [December 4, 2021, 12:29pm UTC](https://www.patreondevelopers.com/t/response-code-401/2845/28 "2021-12-04T12:29:49Z")

</div>

Yes, similar errors still occurring as of 0.5 days ago.

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [December 7, 2021, 11:10pm UTC](https://www.patreondevelopers.com/t/response-code-401/2845/29 "2021-12-07T23:10:38Z")

</div>

Can you try force-refreshing your connection to [patreon.com](http://patreon.com)?

> [@bulb How to upgrade your Patreon WordPress to use API v2](https://www.patreondevelopers.com/t/how-to-upgrade-your-patreon-wordpress-to-use-api-v2/3249):
>
> You can follow the below simple steps to upgrade your Patreon WordPress installation to use API v2, which is required by many advanced features like post sync. 1 - Visit “Patreon settings” menu in your WP admin 2 - Click ‘Connection details’ button 3 - Clear all fields which you can clear, and click Save. 4 - Visit the below page that lists the apps you have at Patreon: 5 - Find the app for your website. You can confirm the app by checking the ‘Redirect uri’ value for the app, visible in …

[Previous page](https://www.patreondevelopers.com/t/response-code-401/2845.md?page=1)
