Closed t5unamie closed 6 years ago
console.log(tokensResponse);
{ access_token: '<REMOVED_FOR_SECURITY>',
expires_in: 2678400,
token_type: 'Bearer',
scope: 'users pledges-to-me my-campaign',
refresh_token: '<REMOVED_FOR_SECURITY>',
version: '0.0.1' }
using the following
var patreon = require('patreon');
var patreonAPI = patreon.default
var patreonOAuth = patreon.oauth
shows an output of undefined when
console.log(patreonAPI);
Okay when I replace the following
var patreonAPIClient = patreonAPI(tokensResponse.access_token)
with the following
var patreonAPIClient = patreonAPI.patreon(tokensResponse.access_token)
I fix one error.
FYI
Version below
npm -v 5.6.0 node --version v9.8.0 npm list --depth=0 +-- body-parser@1.18.2 +-- cookie-parser@1.4.3 +-- debug@2.2.0 +-- express@4.16.3 +-- jade@1.11.0 +-- js-md5@0.7.3 +-- jsonwebtoken@7.4.3 +-- mongoose@4.13.12 +-- morgan@1.9.0 +-- nodemon@1.17.2 +-- passport-patreon@1.0.1 +-- patreon@0.4.0 +-- randomstring@1.1.5 +-- serve-favicon@2.4.5 `-- url@0.11.0
after debugging it's expecting me to send something in the response as the first argument. Most likely a URL. However not sure what it's expecting can you guys help?
Wait I think all the code in here should be my code.
.then(function(result) {
var store = result.store
console.log(store);
// store is a [JsonApiDataStore](https://github.com/beauby/jsonapi-datastore)
// You can also ask for result.rawJson if you'd like to work with unparsed data
response.end(store.findAll('user').map(user => user.serialize()))
I am pretty sure your expecting me to send something back to you now. As I keep checking it and it waits on your login page. It just sits there before timing out. As I change the response.end just to give and ok 200. However you seem to be waiting for something.
Hey there! Sorry it's taken us so long to get back to you. Are you still having this issue?
Yes
On Thu, 19 Apr 2018, 18:53 Philip James, notifications@github.com wrote:
Hey there! Sorry it's taken us so long to get back to you. Are you still having this issue?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Patreon/patreon-js/issues/20#issuecomment-382824969, or mute the thread https://github.com/notifications/unsubscribe-auth/AD8kDkmi5Qwx28tlYYUQiceRBWgfzxnYks5tqM8QgaJpZM4Su5g4 .
Hi @t5unamie,
I apologize for the delay again, let's see if we can get your example working.
I'm afraid the example in the README is out of date, and we'll fix it soon. In the meantime, you can look at examples/server.js for a working example. If you're not using es2015, the imports should look like this:
const { patreon, oauth } = require('patreon');
//...
const oauthClient = oauth(CLIENT_ID, CLIENT_SECRET);
Then you can build your oauth function as in your example or the example in server.js, and create the patreonAPI client from the retrieved accessToken:
const patreonAPI = patreon(accessToken)
Was that helpful?
Testing now. Will get back to you in the next 2 weeks.
On Sat, 5 May 2018, 00:41 Evan Moses, notifications@github.com wrote:
Hi @t5unamie https://github.com/t5unamie,
I apologize for the delay again, let's see if we can get your example working.
I'm afraid the example in the README is out of date, and we'll fix it soon. In the meantime, you can look at examples/server.js https://github.com/Patreon/patreon-js/blob/master/examples/server.js for a working example. If you're not using es2015, the imports should look like this:
const { patreon, oauth } = require('patreon'); //... const oauthClient = oauth(CLIENT_ID, CLIENT_SECRET);
Then you can build your oauth function as in your example or the example in server.js https://github.com/Patreon/patreon-js/blob/master/examples/server.js#L39, and create the patreonAPI client from the retrieved accessToken:
const patreonAPI = patreon(accessToken)
Was that helpful?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Patreon/patreon-js/issues/20#issuecomment-386761038, or mute the thread https://github.com/notifications/unsubscribe-auth/AD8kDjyGXS2sROiFr1XQxD4wcSkjjypqks5tvOcogaJpZM4Su5g4 .
Closing for now. Please re-open if you're still having difficulty.
Was this ever resolved? I am still getting an error.
Any updates on this? I'm having the same errors.
using nodejs with express.
Took your example code and created a route as shown below.
I get the following error out after I get redirected and login
when I console.log(patreonAPI);