Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 34 lines (29 sloc) 1.96 kb
470f532 @ryanj adding OAuth2 example script
ryanj authored
1 <?php
4e855ad @ryanj Outlining 5 easy steps to OAuth2.0 victory with Eventbrite!
ryanj authored
2 # Getting Started with OAuth2.0 for Eventbrite in 5 easy steps #
43b8851 @ryanj reducing minimum required steps for OAuth2 implementation down to two
ryanj authored
3 ## Requirements and prep-work: ##
4 // 1. You must have an API key - Eventbrite API keys are available here: http://www.eventbrite.com/api/key/
5 // 2. Have your Client_Secret ready - Your API_Key's Client secret is available on the same page. Keep it secret! Be careful not to expose it to your users or check it in to publicly available source code.
6 // 3. Update your API_Key's "redirect_uri" setting on http://eventbrite.com/api/key. Point your redirect_uri to the URL on your site where you expect a user to complete their OAuth2.0 authorization. Or, point it to any URL on your site where our loginWidget is available.
7 // 4. Developer terms - To comply with our developer terms, your user's "access_tokens" should be protected, and should not be exposed to other users.
8 // 5. Download Eventbrite's PHP API client and add it to your application's source code - https://raw.github.com/ryanjarvinen/eventbrite.php/master/Eventbrite.php
dfd4928 Update examples/oauth2-login-example.php
ryan jarvinen authored
9 // the 'php5-curl' package may also be a requirement
470f532 @ryanj adding OAuth2 example script
ryanj authored
10
43b8851 @ryanj reducing minimum required steps for OAuth2 implementation down to two
ryanj authored
11 ## Implementing OAuth for Eventbrite in two easy steps: ##
12 // 1. load the API Client library:
13 require_once "../Eventbrite.php";
470f532 @ryanj adding OAuth2 example script
ryanj authored
14
43b8851 @ryanj reducing minimum required steps for OAuth2 implementation down to two
ryanj authored
15 // 1a. (optional) This example uses PHP's built-in $_SESSION storage:
7b90722 @ryanj making more parameters optional, boiling down example code
ryanj authored
16 // See the README file for information about integrating with other data-stores.
17 // This line may be needed to enable session support on your server:
470f532 @ryanj adding OAuth2 example script
ryanj authored
18 session_start();
19
5011f2a Update examples/oauth2-login-example.php
ryan jarvinen authored
20 // 2. Create a login widget OR redirect:
21 $login_widget_html = Eventbrite::loginWidget(array( 'app_key' => 'YOUR_APP_KEY',
22 'client_secret' => 'YOUR_CLIENT_SECRET'));
470f532 @ryanj adding OAuth2 example script
ryanj authored
23 ?>
24 <html>
5011f2a Update examples/oauth2-login-example.php
ryan jarvinen authored
25 <?=$login_widget_html?>
7b90722 @ryanj making more parameters optional, boiling down example code
ryanj authored
26
43b8851 @ryanj reducing minimum required steps for OAuth2 implementation down to two
ryanj authored
27 <?// -------------- Done! ------------- //
28 // Optional debug output - Remove this in your app:
7b90722 @ryanj making more parameters optional, boiling down example code
ryanj authored
29 if ( Eventbrite::getAccessToken()){
43b8851 @ryanj reducing minimum required steps for OAuth2 implementation down to two
ryanj authored
30 print "<p><b>DEBUG:</b> This user's OAuth2.0 access_token is: " . Eventbrite::getAccessToken() . "</p>";
7b90722 @ryanj making more parameters optional, boiling down example code
ryanj authored
31 }
32 ?>
470f532 @ryanj adding OAuth2 example script
ryanj authored
33 </html>
Something went wrong with that request. Please try again.