Patreon API down? or Blocking my app?

Hey Devs,

My app was working just fine up until a few hours ago. It’s now starting to fail on the OAuth portion where Patreon redirects back to my app using the redirect URI along with a temporary authorization code. It’s now giving me a 403 unauthorized error whereas before this has worked flawlessly. I haven’t altered the code since the last time it was working.

This is the error I’m receiving from my logs. Has anyone experienced this before?

 body: `<html><head><title>patreon.com</title><script src="/cdn-cgi/apps/head/7F2Ggij0e_TCnVgy3dJ0eOuIIUs.js"></script><style>#cmsg{animation: A 1.5s;}@keyframes A{0%{opacity:0;}99%{opacity:0;}100%{opacity:1;}}</style></head><body style="margin:0"><p id="cmsg">Please enable JS and disable any ad blocker</p><script>var dd={'cid':'AHrlqAAAAAMAxjRF_mivqqsAA5AHzA==','hsh':'DAA83DD4A3D06098A6A2CE2AD90A76','t':'fe','r':'b','s':35521,'host':'geo.captcha-delivery.com'}</script><script src="https://ct.captcha-delivery.com/c.js"></script></body></html>\n`,
  statusCode: 403

Maybe more readable here so you don’t have to scroll right:

body: `<html><head><title>patreon.com</title><script src="/cdn-cgi/apps/head/7F2Ggij0e_TCnVgy3dJ0eOuIIUs.js"></script><style>#cmsg{animation: A 1.5s;}@keyframes A{0%{opacity:0;}99%{opacity:0;}100%{opacity:1;}}</style></head><body style="margin:0"><p id="cmsg">Please enable JS and disable any ad blocker</p><script>var dd={'cid':'AHrlqAAAAAMAxjRF_mivqqsAA5AHzA==','hsh':'DAA83DD4A3D06098A6A2CE2AD90A76','t':'fe','r':'b','s':35521,'host':'geo.captcha-delivery.com'}</script><script src="https://ct.captcha-delivery.com/c.js"></script></body></html>\n`, statusCode: 403

As I also said at Discord, 403 error is a permission error for a valid token but there is no info about the endpoint and the call. So its difficult to say something with this info.

Thanks for the reply @codebard. It’s failing in the initial OAuth POST request where I should be receiving the authorization token afterward. Here is the request:

let result = await tiny.post({
          url: `https://www.patreon.com/api/oauth2/token?code=${code}&grant_type=authorization_code&client_id=${client_id}&client_secret=${client_secret}&redirect_uri=${redirect_uri}`,
          headers: {
              'content-type': 'application/x-www-form-urlencoded',
              'User-Agent': 'node'
          }
      }) 

After that I’m usually able to do calls to the API such as this:

let getUser = await tiny.get({ url: `https://www.patreon.com/api/oauth2/v2/identity?include=memberships.currently_entitled_tiers,campaign,memberships.campaign&fields${encodeURIComponent('[user]')}=email,first_name,full_name,image_url,last_name,thumb_url,url,vanity,is_email_verified&fields${encodeURIComponent('[post]')}=title,content,is_paid,is_public,published_at,url,embed_data,embed_url,app_id,app_status&fields${encodeURIComponent('[campaign]')}=url`, headers: { Authorization: `Bearer ${token}`, Accept: 'application/json' } })