Title: Client Credentials Jquery get method
Last modified: September 1, 2016

---

# Client Credentials Jquery get method

 *  [sharadmani02](https://wordpress.org/support/users/sharadmani02/)
 * (@sharadmani02)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/client-credentials-jquery-get-method/)
 * Hi Team,
 * I am developing a API using Jquery Ajax Call method to call post of my sites.
   
   I am using “oauth wordpress plugin” to authenticate the Get Call using “Client
   Credentials ” method however it does not return anything. My code is :
 *     ```
       $('document').ready(function() {
            var request = $.ajax({
              url: "http://measinki.com/wp-json/wp/v2/posts",
              type: "GET",
       	   connection: "keep-alive",
              crossDomain: true,
              username:"my-Client ID",
              password:"My-secret-key",
              contentType: "application/json",
              mimeType: "application/json",
                headers:{ 'Access-Control-Allow-Origin': '*',
                         "Access-Control-Allow-Headers": "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"
                        }
       	  });
       	request.done(function(msg) {
                console.log(msg); 
   
       });
       ```
   
 * I do receive error in Console ” Request header field Access-Control-Allow-Origin
   is not allowed by Access-Control-Allow-Headers in preflight response.”
 * Any help will appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Clarion Technologies](https://wordpress.org/support/users/clarionwpdeveloper/)
 * (@clarionwpdeveloper)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/client-credentials-jquery-get-method/#post-7470727)
 * Hello sharadmani02,
 * Can you please try by adding the below line of code in Response headers:
 * “Access-Control-Allow-Methods”: “POST, GET”,
 * Thanks
 *  Thread Starter [sharadmani02](https://wordpress.org/support/users/sharadmani02/)
 * (@sharadmani02)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/client-credentials-jquery-get-method/#post-7470728)
 * Hi,
    I did try the same. Now getting error “Uncaught SyntaxError: Unexpected 
   token ILLEGAL”
 * New code is :
 *     ```
       $('document').ready(function() {
            var request = $.ajax({
              url: "http://measinki.com/wp-json/wp/v2/posts",
              type: "GET",
       	   connection: "keep-alive",
              crossDomain: true,
       	   username:"GKXw1WSmtDtGTtrpy0CmRstOrlnxXI",
              password:"Br@mEsjbug3QJGkqANRZmSCJJ5dywyV3w$02",
              contentType: "application/json",
              mimeType: "application/json",
                headers:{
                    "Access-Control-Allow-Origin" : "*",
                   "Access-Control-Allow-Methods" : "GET,POST,PUT,DELETE,OPTIONS",
                   "Access-Control-Allow-Headers": "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With
                		}
       	  });
       	request.done(function(msg) {
                console.log(msg); 
   
       });
       	});
       ```
   
 *  Thread Starter [sharadmani02](https://wordpress.org/support/users/sharadmani02/)
 * (@sharadmani02)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/client-credentials-jquery-get-method/#post-7470731)
 * Sorry I did miss ” in the end of `"Access-Control-Allow-Headers": "Content-Type,
   Access-Control-Allow-Headers, Authorization, X-Requested-With`
 * Now again initial error message is there ” Request header field Access-Control-
   Allow-Origin is not allowed by Access-Control-Allow-Headers in preflight response.”

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Client Credentials Jquery get method’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [sharadmani02](https://wordpress.org/support/users/sharadmani02/)
 * Last activity: [9 years, 12 months ago](https://wordpress.org/support/topic/client-credentials-jquery-get-method/#post-7470731)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
