hackalive Posted June 17, 2012 Share Posted June 17, 2012 Hi guys, I am using this oAuth library https://github.com/vbardales/oauth2-php, but have taken out the dependencies on Composer. I have one issue. I keep getting this error (on protected_resource.php PDO). Fatal error: Interface 'IOAuth2Storage' not found in A:\public\OAuth2\IOAuth2GrantCode.php on line 13 This is the code of IOAuth2GrantCode.php <?php require_once 'Model/IOAuth2Client.php'; require 'OAuth2/IOAuth2Storage.php'; /** * Storage engines that support the "Authorization Code" * grant type should implement this interface * * @author Dave Rochwerger <catch.dave@gmail.com> * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-4.1 */ interface IOAuth2GrantCode extends IOAuth2Storage { /** * The Authorization Code grant type supports a response type of "code". * * @var string * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-1.4.1 * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-4.2 */ const RESPONSE_TYPE_CODE = OAuth2::RESPONSE_TYPE_AUTH_CODE; /** * Fetch authorization code data (probably the most common grant type). * * Retrieve the stored data for the given authorization code. * * Required for OAuth2::GRANT_TYPE_AUTH_CODE. * * @param $code * Authorization code to be check with. * * @return IOAuth2AuthCode * * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-4.1 * * @ingroup oauth2_section_4 */ public function getAuthCode($code); /** * Take the provided authorization code values and store them somewhere. * * This function should be the storage counterpart to getAuthCode(). * * If storage fails for some reason, we're not currently checking for * any sort of success/failure, so you should bail out of the script * and provide a descriptive fail message. * * Required for OAuth2::GRANT_TYPE_AUTH_CODE. * * @param $code * Authorization code to be stored. * @param IOAuth2Client $client * Client identifier to be stored. * @param $data * Application data * @param $redirect_uri * Redirect URI to be stored. * @param $expires * Expiration to be stored. * @param $scope * (optional) Scopes to be stored in space-separated string. * * @ingroup oauth2_section_4 */ public function createAuthCode($code, IOAuth2Client $client, $data, $redirect_uri, $expires, $scope = NULL); } And the code of IOAuth2Storage.php <?php namespace OAuth2; require_once 'Model/IOAuth2Client.php'; /** * All storage engines need to implement this interface in order to use OAuth2 server * * @author David Rochwerger <catch.dave@gmail.com> */ interface IOAuth2Storage { /** * @return IOAuth2Client */ public function getClient($client_id); /** * Make sure that the client credentials is valid. * * @param $client_id * Client identifier to be check with. * @param $client_secret * (optional) If a secret is required, check that they've given the right one. * * @return * TRUE if the client credentials are valid, and MUST return FALSE if it isn't. * @endcode * * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-3.1 * * @ingroup oauth2_section_3 */ public function checkClientCredentials(IOAuth2Client $client, $client_secret = NULL); /** * Look up the supplied oauth_token from storage. * * We need to retrieve access token data as we create and verify tokens. * * @param $oauth_token * oauth_token to be check with. * * @return IOAuth2AccessToken * * @ingroup oauth2_section_7 */ public function getAccessToken($oauth_token); /** * Store the supplied access token values to storage. * * We need to store access token data as we create and verify tokens. * * @param $oauth_token * oauth_token to be stored. * @param $client_id * Client identifier to be stored. * @param $user_id * User identifier to be stored. * @param $expires * Expiration to be stored. * @param $scope * (optional) Scopes to be stored in space-separated string. * * @ingroup oauth2_section_4 */ public function createAccessToken($oauth_token, IOAuth2Client $client, $data, $expires, $scope = NULL); /** * Check restricted grant types of corresponding client identifier. * * If you want to restrict clients to certain grant types, override this * function. * * @param IOAuth2Client $client * Client to be check with. * @param $grant_type * Grant type to be check with, would be one of the values contained in * OAuth2::GRANT_TYPE_REGEXP. * * @return * TRUE if the grant type is supported by this client identifier, and * FALSE if it isn't. * * @ingroup oauth2_section_4 */ public function checkRestrictedGrantType(IOAuth2Client $client, $grant_type); } Hopefully its not too hard to solve Many thanks in advance. Quote Link to comment Share on other sites More sharing options...
hackalive Posted June 17, 2012 Author Share Posted June 17, 2012 namespace OAuth2; resolved issue Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.