Hello,
I think I’ve followed the instructions pretty well, but can’t get past the first step of getting the access token. I created a new client & API keys:
// Set up the API endpoint URLs
$token_url = 'https://www.patreon.com/api/oauth2/token';
$user_url = 'https://www.patreon.com/api/oauth2/api/current_user';
// Set up the HTTP headers
$headers = [
'Content-Type: application/x-www-form-urlencoded',
];
// Set up the POST data to obtain the access token
$token_data = [
'grant_type' => 'client_credentials',
'client_id' => 'REDACTED',
'client_secret' => 'REDACTED',
];
// Send the request to obtain the access token
$ch = curl_init($token_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($token_data));
$token_response = curl_exec($ch);
curl_close($ch);
However, if gives a status 500 on the token response variable:
[{“code”:null,“code_name”:“InternalError”,“detail”:“An unrecoverable internal server error has occurred.”,“id”:“01f960b8…”,“status”:“500”,“title”:“Internal Error.”}]}"
I’m not sure if this matters, but I’m running this on localhost with XAMPP. Any ideas? I’ve double checked the client_id and client_secret and they are correct.
I would be grateful for any suggestions!
edit: Is the access token that is returned the same as the “Creator’s Access Token”? If so, can I just use this directly? I’m sorry, I’m very new to this. I’m simply trying to find out if someone is a Patreon member or not every time they login to my site.