Jump to content

How to integrate OAuth2 authentication to REST API library


Recommended Posts

Dear trq,


My issue is How the OAuth2.0 authentication can apply to a REST API Web Service. I attached the basic implementation of REST API. The code of 

attached "simple_rest_client->index.php" as follows:

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, "http://localhost/simple_rest_master/test");
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_POST, 1);

	$data = array(
		'username' => 'foo',
		'password' => 'bar'

	curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
	$contents = curl_exec($ch);
	echo $contents;


Here the client call the Controller method "Test" as in cURL http://localhost/simple_rest_master/test. It's URL in localhost is : http://localhost/simple_rest_client/


I also add the code of "Server" in zip file "simple_rest_master.zip".  


In this case I need to implement the authentication using OAuth2.0 . 


I looked the RFC standard for it here : http://tools.ietf.org/html/rfc6749


Please help,




Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.