Class MOXMAN_Auth_Oauth2
| Inheritance | MOXMAN_Auth_Oauth2 |
|---|
This class wrapps Oauth2 protocols.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Constructs a new Oauth2 instance. | MOXMAN_Auth_Oauth2 |
| authorize() | First step in auth | MOXMAN_Auth_Oauth2 |
| refresh() | Refresh access_token | MOXMAN_Auth_Oauth2 |
| request() | Request target by url | MOXMAN_Auth_Oauth2 |
| setToken() | Set Auth Token Manually | MOXMAN_Auth_Oauth2 |
| sign() | Sign request | MOXMAN_Auth_Oauth2 |
| validate() | Validate token | MOXMAN_Auth_Oauth2 |
Method Details
Constructs a new Oauth2 instance.
| public void __construct ( $config ) | ||
| $config | Array | Config options. Required options $config["auth_url"] = "https://accounts.google.com/o/oauth2/auth"; $config["scope"] = "https://www.googleapis.com/auth/userinfo.profile"; $config["callback"] = "http://callbackurl"; $config["client_id"] = "ID"; $config["client_secret"] = "SECRET"; $config["token_url"] = "https://accounts.google.com/o/oauth2/token"; $config["response_type"] = "code"; $config["state"] = "service_name"; |
First step in auth
| public void authorize ( $force = false ) | ||
| $force | Bool | True/false to force user interaction or not. |
Refresh access_token
| public void refresh ( ) |
Request target by url
| public string request ( $url, $method, $data = false ) | ||
| $url | string | URL Target. |
| $method | ||
| $data | Array | Optional, data to send to target in POST. |
| return | string | Response of request to target. |
|---|---|---|
Set Auth Token Manually
| public void setToken ( $token ) | ||
| $token | string | Access Token. |
Sign request
| public Object sign ( $request ) | ||
| $request | Object | Request object to add header too. |
| return | Object | Request object with added header. |
|---|---|---|
Validate token
| public void validate ( $token ) | ||
| $token | string | Token should be gotten by $_GET["code"] from redirect. |