Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesn't accept creator access token #3

Closed
balupton opened this issue Jun 8, 2016 · 4 comments
Closed

doesn't accept creator access token #3

balupton opened this issue Jun 8, 2016 · 4 comments

Comments

@balupton
Copy link

balupton commented Jun 8, 2016

if I go to https://www.patreon.com/platform/documentation/clients there is a creator access token property, if I use that like so:

const patreon = require('patreon').default

const CREATOR_ACCESS_TOKEN = 'asd'

const client = patreon(CREATOR_ACCESS_TOKEN)
client('/current_user', (err, data) => {
    if (err) return console.error(err)
    console.log(data)
})

I get back:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>401 Unauthorized</title>
<h1>Unauthorized</h1>
<p>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.</p>

SyntaxError: Unexpected token < in JSON at position 0
    at Object.parse (native)
    at /Users/balupton/Projects/accounting/sponsored/node_modules/node-fetch/lib/body.js:44:15
    at process._tickCallback (internal/process/next_tick.js:103:7)
@21echoes
Copy link
Contributor

21echoes commented Jun 10, 2016

Hey @balupton! I'm unable to reproduce your issue. Could you please email platform@patreon.com with more details so I can help you debug?

@balupton
Copy link
Author

balupton commented Jun 11, 2016

@21echoes cheers, email sent

@21echoes
Copy link
Contributor

21echoes commented Jun 11, 2016

Responded, and copy/pasted here in case others can learn from it:

Your access token is expired. Please use the patreon.oauth(CLIENT_ID, CLIENT_SECRET).refreshToken(REFRESH_TOKEN, callback) method to retrieve a new access and refresh token.

So sorry about the confusion, our documentation failed you in two ways:

  1. https://www.patreon.com/platform/documentation/clients should either not show expired access tokens, or should make it very clear that the access token is expired (and probably have a "refresh this token" button as well)
  2. https://github.com/Patreon/patreon-js did not make it clear that the refreshToken method even existed

Stuff like this is why the public-facing API is still in semi-hidden beta :( but with help from people like you, we hope to find more and more of these short-comings and get it ready for broader release next quarter! I'll make an issue on our internal tracker for that first issue, and a public one here on this repo for the second issue.

@balupton
Copy link
Author

balupton commented Jun 13, 2016

@21echoes perfect that did the trick, calling .refreshToken even updated the tokens on https://www.patreon.com/platform/documentation/clients too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants