Support » Fixing WordPress » WP REST API Oauth 1.0a

  • I have been trying to make a post from an andriod device to wordpress local installation, which is using XAMPP server, After the github page suggestion, i changed the .htaccess file as follow, anyhow still i get 401 Unauthorize response.

    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /speedy/
    
    # Enable HTTP Auth
    RewriteCond %{HTTP:Authorization} ^(.)
    RewriteRule ^(.) - [E=HTTP_AUTHORIZATION:%1]
    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
    
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /speedy/index.php [L]
    </IfModule>
    
    # END WordPress

    Now it works fine with the plugin Basic Auth but with Oauth 1.0a i still get 401.
    I am using Disable anonymous accessplugin as well.

    Also i dont understand about the callback url, which i have to specify when i create new application using wp oauth server 1.0a in wp-admin area.

    this is the tutorial i have followed.tutorial

Viewing 2 replies - 1 through 2 (of 2 total)
  • How are you sending the OAuth requests from the Android app? Ultimately you will need a token that is included with the request, and you will need to sign the request data. I suggest using an existing client library for this.

    The callback URL is used in step 5 of the “How the OAuth Authentication Flow Works” section from your tutorial. This is how your application will receive the OAuth token.

    Thread Starter pcfjojo

    (@pcfjojo)

    I have been using the “POST MAN” but, I will try with OKHTTP for make the Oauth request, anyhow I have no idea about where i have to start from
    1. I wil call wp rest api endpint /wp-json/ to get the Auth request url to get the authentication token.

    2. with the token, which i get from the response, i will have to request for Authorization (HMAC ecc).

    I dont konw that OKHTTP can do this or not.

    Could you please give me some suggessions?

    • This reply was modified 4 years, 5 months ago by pcfjojo.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WP REST API Oauth 1.0a’ is closed to new replies.