I have two cakePHP apps on 2 different servers. One app is required to get data from the first one; I have succeeded to put the Restful architecture in place but I failed to implement an authentication procedure to the requests the server sends. I need to authenticate to secure the data. I have looked around on the web but can't seem to get it working. Can anyone point me to a resource / tutorial that explains this in detail. What I would ultimately need would be a way to authenticate my server every time it sends a request to the other server. Any help would be appreciated.
Authenticate Restful cakePHP 2.3
1.3k Views Asked by elha At
1
There are 1 best solutions below
Related Questions in PHP
- How to add the dynamic new rows from my registration form in my database?
- Issue in payment form gateway
- How to create a facet for WP gridbuilder that displays both parent and child custom fields?
- Function in anonymous Laravel Blade component
- How to change woocomerce or full wordpress currency with value from USD to AUD
- General questions about creating a custom theme Moodle CMS
- How to add logging to an abstract class in php
- error 500 on IIS FastCGI but no clue despite multiple error loggings activated
- Composer installation fails and reverts ./composer.json and ./composer.lock to original content
- How to isolate PHP apps from each other on a local machine(Windows or Linux)?
- Laravel: Using belongsToMany relationship with MongoDB
- window.location.href redirects but is causing problems on the webpage
- Key provided is shorter than 256 bits, only 64 bits provided
- Laravel's whereBetween method not working with two timestamps
- Implementing UUID as primary key in Laravel intermediate table
Related Questions in REST
- Query parameter works fine with fastapi application when tested locally but not working when the FastAPI application is deployed on AWS lambda
- Add an http GET/POST entry point to a Django with channels websocket
- Difficulty creating a data pipeline with Fabric Datafactory using REST
- Flutter connection to a local api
- Accessing REST API Status Codes using Azure Data Factory Copy Activity (or similar)?
- Mass Resource deletion in REST
- why when I check endpoint /tasks, an error always appears "error : invalid token" even though I have entered the appropriate token that I got
- How to prevent users from creating custom client apps?
- How to create a REST API with .NET Framework?
- Efficiently Handling Large Number of API Calls with Delphi 10.4 and OmniThreadLibrary
- Put Request throwing 401 [no body] Unauthorized
- Converting img src data to octet-stream
- Implementing Email Verification and Notification System in a Full-Stack Application with React Frontend and Node Backend
- Micronaut - Add Controller from external library
- Moving Template or OVA to Datastore using vCenter API
Related Questions in CAKEPHP
- CakePHP2-PHP8 - Tests with PHPUnit ^9.5
- CakePHP 4 Custom Routing Issue with Paginator Links
- I can't retrieve GET values
- Custom error page in cakephp 4 redirect to login page
- having character encoding problem on my blog content in php application
- cakephp bake console error Exception: SQLSTATE[HY000] [2002] No such file or directory in
- How to add the "active" field in authentication with AthenticationService? I use CakePHP 4.x
- Manually joining entity specified in contain
- Contain with alias not working in cakephp 5.x
- How to suppress duplicate code warning in php projects for Sonar Qube scans?
- PHP5.6 with MySQL 8 in Amazon RDS
- Nginx redirects a POST request to GET?
- Segmentation fault (core dumped) when executing a cakephp command with php parallel
- fetching result from database in specific format cakephp5
- CakePHP 5 uploaded file validation always failing
Related Questions in CAKEPHP-2.3
- Can we limit parent in generateTreeList function?
- CakePHP - How To Iterate an Array and Compare Array Values With a Variable
- Cakephp 2 how to paginate a model but restrict the results to only those with a conditional associated model
- How can I remain logged-in in the iframe which is used in a different domain?
- How to declare/export ShellDispatcher in Controller cakephp 2?
- How can I set the samesite cookie attribute in CakePHP 2.3?
- CakePHP -Call to a member function allow() on null
- Cake PHP 2 Model association with finder query
- How to setup Read/Write users in cakephp 2
- Conditionally delete an element from array - Cakephp
- CSS and JS not working over HTTPS in cakephp 2.2.6
- can I ignore connection error in cakephp with several databases?
- How to insert data into two table not associated cakephp
- CakePHP Call To A Member Function query() On Null
- CakePHP - saving to more than two models using save associated
Related Questions in RESTFUL-AUTHENTICATION
- Semmless password reset management for web services
- Web API works with Windows authentication enabled when consumed via Swagger but throws an unauthorized issue when accessed through web app
- Calling API from Power bi Desktop throws multiple errors (API KEY should be provided)
- Why it is still showing 403 forbidden in the response
- How to call restful API (Authenticated endpoints) in SSIS for ETL
- While generating Bearer token getting "This resource must only be accessed over HTTPS. It was incorrectly accessed using HTTP"
- I'm trying to do "blackbox testing" but keep getting a 404 error
- SAML Login still required when using Maximo Asset Management API with python urls.requests
- JSESSIONID from cookie to header
- Imported network request to sign in not producing same results in postman
- Accessing protected restful webservice
- AUthorization for JAX-RS always return null
- Error Coming in UI but response coming correct in console
- Why am I unable to retrieve a Xero item by identifier with a valid access token from Postman?
- How do I fix Unauthorized error: Full authentication is required to access this resource in Kotlin Springboot Web Service
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I finally got it to work after some research; indeed one of the solutions is OAuth. In case you are facing the same problem, I can advise you this Plugin made for CakePHP. In details what I did was put the OAuth Plugin into my API Server and I used it like so for my restful controller:
The function RestObject.token() is what I would call to get an Access token which will be used to give me access to the Resources in my controller. (Note that by declaring OAuth in my controller components, all the resources within my controller will need an access token to be accessible). So on the client Server I would get an access token in the following way:
This assumes that you have clients already set up as explained in the Plugin Doc (replace xxxx by the real values for the client credentials). Once I have my access token, all I have to do is use it as follows:
And here you have it! So start by reading the Oauth Specification to understand the Protocol (in particular the Obtaining Authorization part), see which protocol (can be different from the one I used) applies and adapt to your case by using the Plugin
Tutorial Here