This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace OAuth2\OpenID\Controller; | |
use OAuth2\Controller\AuthorizeController as BaseAuthorizeController; | |
use OAuth2\RequestInterface; | |
use OAuth2\ResponseInterface; | |
/** | |
* @see OAuth2\Controller\AuthorizeControllerInterface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test_wo_restrict_single_access_token( $restriction ){ | |
return true; | |
} | |
add_filter('wo_restrict_single_access_token', 'test_wo_restrict_single_access_token'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test_wo_auth_code_lifetime( $auth_code_lifetime ){ | |
return 60; // seconds | |
} | |
add_filter( 'wo_auth_code_lifetime', 'test_wo_auth_code_lifetime' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test_wo_authorization_code_authorize( $user_id ) { | |
exit( 'Run code to handle custom authorization instead of auto authorization ' . $user_id ); | |
} | |
add_action( 'wo_authorization_code_authorize', 'test_wo_authorization_code_authorize' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'wo_endpoints', 'wo_extend_endpoints' ); | |
function wo_extend_endpoints ( $endpoints ){ | |
$endpoints = array( | |
'is_logged_in' => array( | |
'func' => '_wo_is_logged_in_wo7391', | |
'public' => false | |
) | |
); | |
return $endpoints; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Me Method</p> | |
<form action="https://wp-oauth.com/oauth/me" method="GET"> | |
<input type="text" name="access_token" value="" /> | |
<button type="submit">Call Me Method</button> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* OAuth 2.0 CommonJS Client for Titanium Mobile | |
* | |
* @author Justin Greer <[email protected]> | |
* @copyright 2015 Justin Greer | |
* @version 1.0.0 | |
*/ | |
var Client = function() { | |
this._serverUrl = 'serverurl.com'; //without trailing slash | |
this._clientId = 'client_id'; // client id form WP OAuth Server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var constants = Object.freeze({ | |
type:'oauth2', | |
name:'wpoauthserver', // Something unique to your OAuth provider in lowercase, like “github”, or “nodebb” | |
oauth: { | |
requestTokenURL: '', | |
accessTokenURL: '', | |
userAuthorizationURL: '', | |
consumerKey:'', | |
consumerSecret: '' | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="<?php echo $server_url; ?>/oauth/token" method="POST"> | |
<input type="text" name="refresh_token" value="" /> | |
<input type="hidden" name="grant_type" value="refresh_token" /> | |
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>" /> | |
<input type="hidden" name="client_secret" value="<?php echo $client_secret; ?>" /> | |
<button type="submit">Request New</button> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple Example of a client calling WordPress OAuth Server | |
* Replace the variabls below with your own. | |
* | |
* @author Justin Greer <[email protected]> | |
*/ | |
$server_url = 'https://wordpress.dev'; | |
$client_id = '6lkmsGocFcvxVG4S5s3QCHGi5Pvutl8AHtXaalmP'; | |
$client_secret = 'yRntyrmDTquw7bOd0kHuFQ5mj2wtnSjVKGpi8MW2'; |