REST API integration using oAuth


(Maheshvarma M) #1

Hi,


We have a REST API which uses oAuth authetication. We want to try integrating it with Squiz matrix.



Authorisation and request access token step:

https://www.api.mahesh.com/appsapi/oauth/authorize?grant_type=password&client_id=<<client id provided by

service provider>>&username=mahesh@gmail.com&client_secret=<<client secret key provided by service provider>>



Above URL also prompts for username/password. If credentials are correct, it will return access_token in JSON object.



Getting profile details step:

Put access token in request header and fire request to URL: https://www.api.mahesh.com/appsapi/core/v1/profile/mahesh. This will return XML response.



Can i achieve this using REST Resource and oAuth assets provided in Matrix? Or do matrix requires custom development to support this?


(Edison Wang) #2

http://manuals.matrix.squizsuite.net/web-services/chapters/rest-resource-assets/


Sounds like it should work, please check the manual.

You need to use the Rest Resource asset, choose oAuth auth, and select the oAuth session asset.


(Luke Wright) #3

Mod note: I've split off the new question that was previously here into its own thread ("Has anyone successfully implemented the Twitter REST api?") for housekeeping reasons, mainly to make it easier to answer this thread OP's question.


Although a while ago now, the OP to the thread you're reading now was effectively asking about Matrix support for OAuth 2.0 - which I understand is not currently supported by Matrix's OAuth-related assets such as REST Resource OAuth Session. These were written for OAuth 1.0, which is an entirely different model to the most recent drafts of the new OAuth version.