Skip to content

Commit f9a9078

Browse files
authored
Merge pull request #79 from codebard/clearer_instructions_for_urls_and_domains_in_examples
Added clearer descriptions for domains/urls used in the examples and readme
2 parents a1cfdcd + 8304610 commit f9a9078

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ Currently the repo at packagist is at 0.3.x and API v1 only, whereas the one at
2424

2525
### Step 1. Get your client_id and client_secret
2626

27-
Visit the [Patreon platform documentation page](https://www.patreon.com/platform/documentation)
28-
while logged in as a Patreon creator to register your client.
27+
Visit the [Patreon platform documentation page](https://www.patreon.com/platform/documentation) while logged in as a Patreon creator to register your client.
2928

3029
This will provide you with a `client_id` and a `client_secret`.
3130

@@ -59,12 +58,11 @@ $client_secret = ''; // Replace with your data
5958

6059
// In this case, say, /patreon_login request uri
6160

62-
$redirect_uri = "http://mydomain.com/patreon_login";
61+
$redirect_uri = "http://mydomain.com/patreon_login"; // Replace http://mydomain.com/patreon_login with the url at your site which is going to receive users returning from Patreon confirmation
6362

6463
// Generate the oAuth url
6564

66-
$href = 'https://www.patreon.com/oauth2/authorize?response_type=code&client_id='
67-
. $client_id . '&redirect_uri=' . urlencode($redirect_uri);
65+
$href = 'https://www.patreon.com/oauth2/authorize?response_type=code&client_id=' . $client_id . '&redirect_uri=' . urlencode($redirect_uri);
6866

6967
// You can send an array of vars to Patreon and receive them back as they are. Ie, state vars to set the user state, app state or any other info which should be sent back and forth.
7068

@@ -74,7 +72,7 @@ $state = array();
7472

7573
// Lets make it a thank you page
7674

77-
$state['final_page'] = 'http://mydomain.com/thank_you';
75+
$state['final_page'] = 'http://mydomain.com/thank_you'; // Replace http://mydomain.com/thank_you with the url that has your thank you page
7876

7977
// Add any number of vars you need to this array by $state['YOURKEY'] = VARIABLE
8078

examples/create_webhook_to_notify_campaign_changes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
'members:update',
3434
'members:delete',
3535
),
36-
'uri' => 'https://pat-php-dev.codebard.com', // Note that your url must start with https://
36+
'uri' => 'https://yourdomain.com/webhook_receiver', // Replace https://yourdomain.com/webhook_receiver with the url at your site/app thats going to receive webhook requests. Note that your url must start with https://
3737
),
3838
'relationships' => array (
3939
'campaign' => array (

examples/log_in_user_via_patreon.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414

1515
// In this case, say, /patreon_login request uri
1616

17-
$redirect_uri = "http://mydomain.com/patreon_login";
17+
$redirect_uri = "http://mydomain.com/patreon_login"; // Replace http://mydomain.com/patreon_login with the url at your site which is going to receive users returning from Patreon confirmation
1818

1919
// Generate the oAuth url
2020

21-
$href = 'https://www.patreon.com/oauth2/authorize?response_type=code&client_id='
22-
. $client_id . '&redirect_uri=' . urlencode($redirect_uri);
21+
$href = 'https://www.patreon.com/oauth2/authorize?response_type=code&client_id=' . $client_id . '&redirect_uri=' . urlencode($redirect_uri);
2322

2423
// You can send an array of vars to Patreon and receive them back as they are. Ie, state vars to set the user state, app state or any other info which should be sent back and forth.
2524

@@ -29,7 +28,7 @@
2928

3029
$state = array();
3130

32-
$state['final_page'] = 'http://mydomain.com/thank_you';
31+
$state['final_page'] = 'http://mydomain.com/thank_you'; // Replace http://mydomain.com/thank_you with the url that has your thank you page
3332

3433
// Add any number of vars you need to this array by $state['key'] = variable value
3534

examples/unified_flow_oauth_login_register_pledge_redirect.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
// In this case, say, /patreon_login request uri. This doesnt need to be your final redirect uri. You can send your final redirect uri in your state vars to Patreon, receive it back, and then send your user to that final redirect uri
3838

39-
$redirect_uri = "http://mydomain.com/patreon_login";
39+
$redirect_uri = "http://mydomain.com/patreon_login"; // Replace http://mydomain.com/patreon_login with the url at your site which is going to receive users returning from Patreon confirmation
4040

4141
// Min cents is the amount in cents that you locked your content or feature with. Say, if a feature or content requires $5 to access in your site/app, then you send 500 as min cents variable. Patreon will ask the user to pledge $5 or more.
4242

@@ -60,9 +60,7 @@
6060

6161
$state = array();
6262

63-
$state['final_redirect'] = 'http://mydomain.com/locked-content';
64-
65-
// Or, http://mydomain.com/premium-feature. Or any url at which a locked feature or content will be unlocked after the user is verified to become a qualifying member
63+
$state['final_redirect'] = 'http://mydomain.com/locked-content'; // Replace http://mydomain.com/locked-content with the url of the content to be unlocked at your site, or whever you want the user to be directed to after returning from Patreon login/confirmation
6664

6765
// Add any number of vars you need to this array by $state['key'] = variable value
6866

@@ -99,7 +97,6 @@
9997

10098
}
10199

102-
103100
// After linking an existing account or a new account with Patreon by saving and matching the tokens for a given user, you can then read the access token (from the database or whatever resource), and then just check if the user is logged into Patreon by using below code. Code from down below can be placed wherever in your app, it doesnt need to be in the redirect_uri at which the Patreon user ends after oAuth. You just need the $access_token for the current user and thats it.
104101

105102
// Lets say you read $access_token for current user via db resource, or you just acquired it through oAuth earlier like the above - create a new API client

0 commit comments

Comments
 (0)