How to create a "Login with Patreon" button

Can someone explains what i need to make a simple login with patreon button in my site?

So far i made a webservice in java that can receive the access token and get access to Patron data as needed, but now im stuck in the part where i need to create a site for the user to click and login with his patreon account. I cant use webservices? need to make using PHP or what?

1 Like

The approach you take is (in general) the same regardless of language. You’ll need to be able to deliver HTTP responses to visitors to your website, and make requests to the Patreon API, and pretty much every language can do that. You could implement this using a web service but that’s additional complexity that you don’t necessarily need, all of this functionality can be implemented in a single page.

  1. A user visits your website and clicks “Login with Patreon” which is a Login button URL containing your client ID and redirect URI – note: you can also automatically redirect, it doesn’t have to be a login button
  2. The user is asked by Patreon if they authorise your application to have access to their account information, if the user clicks accept:
  3. The user is redirected back to your website with a code parameter
  4. You take the code parameter value and send it to the Patreon API asking for an access token
  5. Patreon responds to your request with an access token which grants you access to the Patreon API on behalf of the user who logged in via Patreon
  6. Optional: You store the access token associated with the user in some way (session, local storage, database etc.)
  7. You make requests to the Patreon API with the access token to retrieve the user’s information

I have an example PHP project available on GitHub that implements this process which includes a step-by-step guide to implementing or you can download and use as-is, and you can find examples for a bunch of other languages in the various official Patreon libraries:

1 Like

thx man, i just found out that i was using outdated patreon api (0.1.1) in java because the Dependency settings description seems to be outdated in the API reference site.

i will try the PHP

If you run into any issues, or need any guidance, let me know – happy to provide step by step help for use of my PHP library :slight_smile: