Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to integrate OAuth2 authentication to REST API library

Featured Replies

Dear Friends,


I am using Simple-REST Library for my REST Web service purpose . I need to integrate "OAuth2.0" with my REST API skeleton.


I attached the REST - API Client & Server for your reference . Please check it and help me with a good solution for implementation.


The code of attached "simple_rest_client->index.php" as follows:



<?php
$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);

curl_close($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 as "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,



Thanks,


Anes




simple_rest_client.zip

simple_rest_master.zip

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.