i am developing android app for website, and have done coding for login page which contains username and password for my website(Job Roller), i have stuck up in validating and authenticating the username and password from remote web server, do i have to upload any code to the web-server?? please can anybody guide me? Thanks in Advance:)
2 Answers
Use the XMLRPC API.
*All these tips are for a self-hosted blog. Not sure if they are relevant to a wordpress.com blog
Don't forget to include /wp-admin after your sites name in the URL box. This may seem like a no brainer but I was not putting this in at first. :) eg. http://www.yoursitesname.com/wp-admin
XML-RPC functionality is turned off by default in WordPress smaller WordPress 3.5. Enable remote blogging in your wordpress setttings by going to: Settings -> Writing -> Now make sure the box is checked next to XML-RPC
With WordPress 3.5 is the XML_RPC Surface active only default; only deactivation with
add_filter( 'xmlrpc_enabled', '__return_false' );
At this point you will want to add you username and password. Yet again, here is something I was doing wrong. I was adding my password to my website, the one that I use to add new themes or plugins. You need to be adding your username and password that you set up for your wordpress login, which may be different.
Finally, I was getting the error "Unable to locate XMLRPC endpoint". To solve this you may need to do some digging, but most should be able to follow this example. When you enable XML-RPC in your Wordpress control panel, it adds a xmlrpc.php file to the directory of your website. You need to enter the URL for this file next to the XMLRPC. For most users, the location of this file should be in your root directory. So, you should be entering the following: http://www.yoursitesname.com/xmlrpc.php. If that is not working, login to your site with an FTP client and try to manually locate the xmlrpc.php file, and note the location, so you can enter the URL.
At this point, you should be good to go.
One more thing, most sites should make sure that HTTP authentication is set to OFF.
1) HTTPS Request to server for Authorization with token
2) code in plugin/fucntions.php/mu-plugin/where ever where this coder want to palce your code
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['ANDROID_APP_TOKEN']) && $_POST['ANDROID_APP_TOKEN'] == 'some token'){
add_filter( 'authenticate', 'wpse73274_authenticate', 40, 3 );
}
function wpse73274_authenticate( $user, $username, $password ){
if (!is_wp_error($user)){
echo 'OK';
//var_dump/json_ecode/wddx_serialize of user or required info
exit;
}
return $user;
}
-
-
I thougth the comunity inspires people to research posibilities and learn... But I got it... its only for solutions. Commented Nov 20, 2012 at 13:44
-
Our goal is to collect canonical answers: Why do things work or not. How can this be used in $example. What are the Pros and cons of a solution. That’s why code/link only answers are not welcome. I found this answer in our Low Quality queue – probably not the place where you want to be seen. :)– fuxia ♦Commented Nov 20, 2012 at 13:49
-
Hi, Code Monkey, I came back to complain about you giving canned responses... The first version of this Answer is exactly the same as here. I'm not locating one relevant Meta discussion I've seen, but this 2 are a worth read. Well, the whole Meta is full of interesting readings about the inner workings of the site :P Commented Nov 20, 2012 at 15:51
-
1Oh, yes, your other Answer inspired me to research and learn, thanks :) Commented Nov 20, 2012 at 15:53