• Resolved NSquared

    (@croixhaug)


    I’ve been trying to use this plugin, and have become familiar with the individual functions. I understand the concept of OAuth, but I’m still struggling with the basic code I need to generate a link to get a request token & authorize the user.

    I came up with the following but it’s not working:

    $request = new OP_OAuthRequest(
    		$signature_method = new OP_OAuthSignatureMethod_HMAC_SHA1(),
    		$consumer = new OP_OAuthConsumer('wKfJ4Hdy', '9aKBePAOqZJr2J1T'),
    		$token = null
    	);

    How do I request token and authorize the user so I can use the oauth functions like sayHello? That pattern makes sense but I’m stuck on the auth process.

    Thanks for your help

    https://www.ads-software.com/extend/plugins/oauth-provider/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter NSquared

    (@croixhaug)

    For those googling who have the same issue, after much digging here is a PHP snippet that will generate a valid signed oauth request using HMAC-SHA1. This is a working sample of a request_token URL using this plugin

    $oauth_args = array(
    		'oauth_consumer_key' => '**************',
    		'oauth_timestamp' => time(),
    		'oauth_nonce' => wp_create_nonce(time()),
    		'oauth_signature_method' => 'HMAC-SHA1',
    	);
    	$request = new OP_OAuthRequest('GET', home_url('oauth/request_token'), $oauth_args);
    	$request->sign_request(
    		$signature_method = new OP_OAuthSignatureMethod_HMAC_SHA1(),
    		$consumer = new OP_OAuthConsumer(
    			$key = '**************',
    			$secret = '**************'
    		),
    		$token = null
    	);
    	$request_token_url = $request->to_url();

    Hi,
    i tried to use your code, and this :

    https://code.google.com/p/oauth-php ( client examples)

    I don’t understand how to use this plugin ?

    Can you help me ?

    Thx

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: OAuth Provider] Request tokens / auth process’ is closed to new replies.