Title: localhost endpoint
Last modified: August 31, 2016

---

# localhost endpoint

 *  Resolved [luisfernandocs](https://wordpress.org/support/users/luisfernandocs/)
 * (@luisfernandocs)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/)
 * Hello,
    I’m trying to authenticate localhost by using the following endpoint (
   [http://localhost/wordpress/oauth/authorize](http://localhost/wordpress/oauth/authorize)),
   but I get the error 404 ( Not Found The requested URL /wordpress/authorize was
   not found on this server.)
 * I am following this model in this tutorial: [https://www.youtube.com/watch?v=pRFCmjiRNco](https://www.youtube.com/watch?v=pRFCmjiRNco)
 * Using this project :
    [https://github.com/adoy/PHP-OAuth2](https://github.com/adoy/PHP-OAuth2)
 * If someone can help me , I’ll be grateful!
 * [https://wordpress.org/plugins/oauth2-provider/](https://wordpress.org/plugins/oauth2-provider/)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/localhost-endpoint/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/localhost-endpoint/page/2/?output_format=md)

 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175412)
 * [@luisfernandocs](https://wordpress.org/support/users/luisfernandocs/)
 * Hi and sorry if you are having issues. One thing to remember with using pretty
   permalinks structure to to ensure that permalinks are set to something other 
   then default in WP.
 * Settings-> Permalinks and check and option other than default.
 * Please let me know if this helps you.
 * Thanks
 *  Thread Starter [luisfernandocs](https://wordpress.org/support/users/luisfernandocs/)
 * (@luisfernandocs)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175424)
 * Hi Justin,
 * Thank you.
 * Settings-> Permalinks and check and option other than default.
    Same error
 * Settings-> Permalinks and check and option default.
    Error 404, too.
 * In terminal:
    `php test.php`
 * Appears “Redirect”.
 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175425)
 * Does it work if you use the endpoint `http://localhost/wordpress?oauth=authorize`.
   If so your local environment is not a good place to test or fix the rewrite mod.
 * If you are still getting an error, ensure that WP OAuth Server is activated and
   you are using the latest version.
 *  Thread Starter [luisfernandocs](https://wordpress.org/support/users/luisfernandocs/)
 * (@luisfernandocs)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175475)
 * Thank you Justin.
 * I tried with `http://localhost/wordpress?oauth=authorize` and the url changed
   to `http://localhost/wordpress?oauth=authorize?response_type...`
 * Then I changed the url to `http://localhost/wordpress?oauth=authorize&response_type...`
 * The problem was the ” ? ” before response_type . The URL is automatically generated
   by php plugin I’m using.
 * Now I get the Authorization Code.
 * Later I will try to get the access token!
 *  Thread Starter [luisfernandocs](https://wordpress.org/support/users/luisfernandocs/)
 * (@luisfernandocs)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175501)
 * Now for the access token , I have the following error:
    301 error (Moved Permanentyly)
 * using this:
 * `curl -u client_id:client_secret http://localhost/wordpress?oauth=token -d ‘grant_type
   =authorization_code&code=xxx’`
 * is correct to use:
 * `http://localhost/wordpress?oauth=token`
 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175517)
 * You may have to tell cURL to to follow the redirect using the `-L` flag.
 *     ```
       curl -u client_id:client_secret -L http://localhost/wordpress?oauth=token -d ‘grant_type=authorization_code&code=xxx’
       ```
   
 *  Thread Starter [luisfernandocs](https://wordpress.org/support/users/luisfernandocs/)
 * (@luisfernandocs)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175528)
 * Using -L flag:
 * {“error”:”invalid_request”,”error_description”:”The request method must be POST
   when requesting an access token”,”error_uri”:”http:\/\/tools.ietf.org\/html\/
   rfc6749#section-3.2″}
 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175530)
 * Try the following. I think the parameter order may be wrong.
 *     ```
       curl -L -u client_id:client_secret http://localhost/wordpress?oauth=token -d ‘grant_type=authorization_code&code=xxx’
       ```
   
 *  Thread Starter [luisfernandocs](https://wordpress.org/support/users/luisfernandocs/)
 * (@luisfernandocs)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175531)
 * Using:
 * > [http://localhost/wordpress?oauth=authorize&response_type=code&client_id=code&redirect_uri=http://localhost/test/test.php](http://localhost/wordpress?oauth=authorize&response_type=code&client_id=code&redirect_uri=http://localhost/test/test.php)
 * I receive:
 * > [http://localhost/test/test.php?code=2csyqfnlerait4gvtdwok3m56hk6jqncbmlrdkox](http://localhost/test/test.php?code=2csyqfnlerait4gvtdwok3m56hk6jqncbmlrdkox)
 * Then using:
 * > curl -L -u client_id:client_secret [http://localhost/wordpress?oauth=token](http://localhost/wordpress?oauth=token)-
   > d ‘grant_type=authorization_code&code=2csyqfnlerait4gvtdwok3m56hk6jqncbmlrdkox’
 * I receive:
 * > {“error”:”invalid_request”,”error_description”:”The request method must be 
   > POST when requesting an access token”,”error_uri”:”http:\/\/tools.ietf.org\/
   > html\/rfc6749#section-3.2″}
 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175596)
 * cURL should allow for redirects. It looks like the parameter L is causing the
   conflict while trying to fix the issue.
 * Check the last part of [http://bshaffer.github.io/oauth2-server-php-docs/grant-types/authorization-code/](http://bshaffer.github.io/oauth2-server-php-docs/grant-types/authorization-code/)
   for examples of how cURL is used.
 *  Thread Starter [luisfernandocs](https://wordpress.org/support/users/luisfernandocs/)
 * (@luisfernandocs)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175620)
 * I tried in Postman on a Windows O.S, like the tutorial, with the Basic Auth, 
   and I receive the same error.
 * When I check the access log:
 *     ```
       ::1 - - [25/Mar/2016:18:46:55 -0300] "POST /wordpress?oauth=token HTTP/1.1" 301 347 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36"
       ::1 - HReing370cAxrDoe12AsBnKTv7ZNBe [25/Mar/2016:18:46:55 -0300] "GET /wordpress/?oauth=token HTTP/1.1" 405 178 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36"
       ```
   
 * After POST, a new request, but GET.
 * Sorry, I’m new in Oauth2.
 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175621)
 * No need to apologies 🙂
 * Try posting to the following instead. I see you are running WP in a sub directory.
 *     ```
       /wordpress/?oauth=token
       ```
   
 * Note the last slash after “wordpress”.
 * If that does not work.
    Try to remove all plugins and switch back to the twenty
   sixteen theme them try again.
 *  Thread Starter [luisfernandocs](https://wordpress.org/support/users/luisfernandocs/)
 * (@luisfernandocs)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175622)
 * Yeah, thanks.
    Now the return in Postman is:
 *     ```
       {
         "error": "unsupported_grant_type",
         "error_description": "Grant type \"password\" not supported"
       }
       ```
   
 * I using like the tutorial in: [https://wp-oauth.com/knowledge-base/using-postman-and-wp-rest-api/](https://wp-oauth.com/knowledge-base/using-postman-and-wp-rest-api/)
 * grant_type = password
 * But I believe in my linux o.s will work using cURL.
 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175624)
 * [@luisfernandocs](https://wordpress.org/support/users/luisfernandocs/)
    As you
   mentioned, you are using the password grant type. This is a licensed feature 
   only. The licensed version opens all features and allows for unlimited clients.
 * Sorry for the inconvenience.
 *  Thread Starter [luisfernandocs](https://wordpress.org/support/users/luisfernandocs/)
 * (@luisfernandocs)
 * [10 years ago](https://wordpress.org/support/topic/localhost-endpoint/#post-7175626)
 * Thanks Justin.
 * Using the following posting worked properly.
 *     ```
       curl -u ClientID:ClientSecret -L http://localhost/wordpress/?oauth=token -d 'grant_type=authorization_code&code=xxx&redirect_uri=http://localhost/test
       ```
   
 * Thank you very much.

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/localhost-endpoint/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/localhost-endpoint/page/2/?output_format=md)

The topic ‘localhost endpoint’ is closed to new replies.

 * ![](https://ps.w.org/oauth2-provider/assets/icon-256x256.gif?rev=2603051)
 * [WP OAuth Server (OAuth Authentication)](https://wordpress.org/plugins/oauth2-provider/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/oauth2-provider/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/oauth2-provider/)
 * [Active Topics](https://wordpress.org/support/plugin/oauth2-provider/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/oauth2-provider/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/oauth2-provider/reviews/)

 * 16 replies
 * 3 participants
 * Last reply from: [trevorstokes](https://wordpress.org/support/users/trevortokes/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/localhost-endpoint/page/2/#post-8614609)
 * Status: resolved