A simple and easy to use PHP library for the Stack Exchange API.
Static Public Member Functions | Public Attributes | Static Public Attributes
Auth Class Reference

Provides access to the methods that require OAuth 2.0 authentication. More...

List of all members.

Static Public Member Functions

static BeginExplicitFlow ($redirect_uri, $scope=self::ReadInbox, $state=null)
 Begins the explicit authentication flow.
static CompleteExplicitFlow ($redirect_uri)
 Completes the explicit authentication flow.

Public Attributes

const ReadInbox = 'read_inbox'
 Provides access to the user's inbox.
const NoExpiry = 'no_expiry'
 Provides an access token that does not expire.

Static Public Attributes

static $client_id = null
 The client ID for the application.
static $client_secret = null
 The client secret for the application (only needed if the explicit OAuth flow is used).

Detailed Description

Provides access to the methods that require OAuth 2.0 authentication.

This class manages settings and provides methods for accessing private data on Stack Exchange sites. All of the methods below will help you authenticate and gain the appropriate permissions to access the data.

Member Function Documentation

static Auth::BeginExplicitFlow ( redirect_uri,
scope = self::ReadInbox,
state = null 
) [static]

Begins the explicit authentication flow.

$redirect_urithe URL to redirect to after authentication is complete
$scopeone of Auth::ReadInbox (the default) or Auth::NoExpiry
$statean optional value that will be returned later

Note: this method must be called before any output is sent to the client since it will issue a 'location' HTTP header. Any output after calling this method will likely not be seen by the client.

Once the client requests $redirect_uri, you must call Auth::CompleteExplicitFlow() to complete the authentication process.

static Auth::CompleteExplicitFlow ( redirect_uri) [static]

Completes the explicit authentication flow.

$redirect_urithe URL provided to Auth::BeginExplicitFlow()
a valid access token

Note: if anything goes wrong, this method will throw an APIException.

The documentation for this class was generated from the following file:
 All Classes Functions Variables