WordPress.com OAuth2 Not working
-
Hello,
I want to integrate my application with wordpress.com API.My need:
I want to see my wordpress site’s pageviews in my Web application.
What i have?
I created an wordpress app
I’ve client ID & secret KeyHere’s My test.php
$curl = curl_init( 'https://public-api.wordpress.com/oauth2/token' ); curl_setopt( $curl, CURLOPT_POST, true ); curl_setopt( $curl, CURLOPT_POSTFIELDS, array( 'client_id' => '*****', 'redirect_uri' => 'https://********/test.php', 'client_secret' => '********************************', 'code' => $_GET['code'], // The code from the previous request 'grant_type' => 'authorization_code' ) ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1); $auth = curl_exec( $curl ); $secret = json_decode($auth); $access_key = $secret->access_token;I can successfully access and approve my wordpress website using this link
https://public-api.wordpress.com/oauth2/authorize?client_id=*****&redirect_uri=*******&response_type=codeAfter i approve,
It redirects to my redirect URL and Successfully generates code parameter in the URL like this,https://********/test.php?code=*******but then when i print the access key it says “invalid_grant”
Note: I also used normal email, password auth, and its works pretty well. but i need OAuth for better flexibility
-
Hi @theswarajsahu, this one’s above my head, but we’re checking in with our developers on this & will let you know what we find.
- The topic ‘WordPress.com OAuth2 Not working’ is closed to new replies.