Hello,
How can I make use of the Patreon API from my meteor app?
Can you please guide on how to do this?
Thanks
Hello,
How can I make use of the Patreon API from my meteor app?
Can you please guide on how to do this?
Thanks
You can use the Patreon API from meteor with the patreon
package on npm.
The documentation for using the Patreon API is here:
https://docs.patreon.com/?javascript
Without a more specific question on what you are trying to do, what you have tried so far, and what issue you are encountering, I canât help any further than pointing to the official resources
Thanks for the reply.
I have a link labeled âLink your Patreon accountâ that goes to an url like this:
www.patreon.com/oauth2/authorize
?response_type=code
&client_id=<your_client_id>
&redirect_uri=<your_redirect_uri>
I am using Flow router that doesnât support server routes.
How do I read the code query param when Patreon redirects back to my Meteor app?
https://mymeteorapp.com/custom-uri
?code=<single_use_code>
&state=<string>
Then I have to call an http api via POST method,
How is this done with Meteor? axios? fetch?
Thanks for your reply, youâve saved me a couple of time in the past.
Would the webapp package be useful for this? It will run from the server and accept the incoming request before it passes it on.
See the example url:
// Listen to incoming HTTP requests (can only be used on the server).
WebApp.connectHandlers.use('/hello', (req, res, next) => {
res.writeHead(200);
res.end(`Hello world from: ${Meteor.release}`);
});
Then your url could be something like (instead of /hello itâd be something like /patreon-callback-uri or whatever you tell Patreon what your calback uri is )
https://mymeteorapp.com/patreon-callback-uri
?code=<single_use_code>
&state=<string>
Then youâd read the query params from the req object.
I think that should work.
Thanks for your reply.
After reading the query param the req object and saving it to the user collection
I would have to do a redirect to a route define with Flow router?
How do I exec a POST call with the code query param from there?
Youâd do a HTTP.call(âpostâ, with your post payload) or HTTP.post (with your post payload) within the connectHandler, and do a res.end() to tell Patreon youâve received the info, then call next() - that should send the request onto the client, which your route can then pick up.
I think (hope!) thatâs the way it works - give it a whirl!
edit: Iâm going to look like a damn fool if it doesnât.