Authenticating Android User through CakePHP Auth - android

I know this is a general question and specifics are better here, but I don't know what specifics to ask yet.
Firstly, does anyone in the community here have experience with building and Android app that authenticates through a CakePHP site that uses the Cake Auth component?
I am currently walking through this tutorial Android Login and Registration with PHP, MySQL and SQLite and I am able to get it to do some things. When trying to login from my app I am getting a "Incorrect username/password" which means that I am making connection to my Cake application, but cannot get any further.
If you will notice in the instructions and the files it handles a value for $salt which has a specific value in the DB they tell you to create. Well with Cake you already have a users table tied to Auth and the $salt value is used by all users and not specific. Any ideas about how to get around this??? This is where I think my glitch is coming from.

Configure a login action that takes the posted login form sent by your login activity, and if login successful the action redirects you to an XML view or json view, inside your android app you parse the result and welcome the user. Sounds good:-)

Related

Facebook SDK for Android: Trying to get a notification when one "likes/comment" the post made by my Android app

I'm fairly new to Facebook SFD for Android.
What I'm trying to achieve is an Android app that uses facebook login, post to the user timeline and gets notified whenever one is commenting or liking that post.
I went thru Facebook tutorials for login and for Publish to Feed.
All went well.
Now I'm struggling with the last part. I don't see how to be notified whenever there is a like or comments. I browsed the web and stackoverflow forum without any success. I'm guessing that there is a mechanism to be notified by Facebook and that I don't have to start a process just to monitor the post...
Anyone could give me a hint on the API to use?
I'm currently looking at "Creating Object Types" section Associating Actions with Object Creation (https://developers.facebook.com/docs/opengraph/creating-object-types) but it looks like this describes how to do for facebook web app, and not for android app.
EDIT
I've found this https://developers.facebook.com/docs/graph-api/real-time-updates/ but not quite sure how to "translate" this into Android coding.
If anyone could help me with this, it would be greatly appreciated.
I guess you have to create a page in php that will handle the responses from Facebook, it starts with a
GET response from Facebook that you retrieve with $_GET["name"] in php, and you have to send back a confirmation to Facebook to confirm that the connection works, and Facebook will send you the answer you want via
a POST request ( $_POST["name"] ) (with a json object, containing the informations about the user in object for example, and the different updates in entry).
You can put all these informations in a database, and when the user start your application, you can automatically connect him to a php script that check if the database has new informations for him.
(specifying who he is, with a user variable that he keeps in the memory of his device, and then you ask for informations from the database about this user). I haven't tested, but it should work.

gcm map users, webview login - Android/php

I would like to map the gcm reg id to individual users on my site.
What is the best way to accomplish this?
I have a webview in android that loads my site where users are required to login, until login users are anonymous so i can only map the users after login.
some thoughts are,
Set the user agent string to the reg id if its not been registered, when logged in , if no id is mapped to the user then grab it from the user agent string.
^^ that seems the easiest way for me as i'm a beginner but i can think of some flaws straight away.
Monitor the page url, if this can be done. when the webview detects the url is "index.php"(user is logged in) then executes the function within the application to send the reg id to the server.
inject the code into a hidden field in the page before login and submit it with that?
I'm not sure if any of these methods are viable, any help would be much appreciated. I'm still pretty much beginner so laymans terms would be also appreciated.
You can pass data from the java code that receives the Registration ID (from Google) to your Web View by using javascript, as explained in the answer to this question.
Or you can load the Web View only after getting the Registration ID from Google. This way you can pass it as a parameter to the URL you are loading.
Ok by far the best way for me was to expose the javascript interface in the webview, i placed a check in my sessions.php after authentication, if the registration key wasn't in the database then it would call a java function in the application that is essentially an ajax call to another script on the website in which the reg key is passed to and saved in the database along with the user id.

Showing data from a Website

i am fairly new at developing with Android but am trying to learn to learn new things:
I wanted to build a simple app that would take data from a website and then show it on the app. I considered using WebView but WebView seems to just put a browser within the app.
I understand that an app such as this would have to 1) Communicate a login and password and pass it to the website and then 2) show the data in the app
What i wanted to do was integrate the data into the app. Another question is if there are any implications regarding this type of app because a user would have to log in using a Username and Password.
So how could I go about this(i just need some general pointers, what to use, etc.)
Thank You!
You can use an HTTPClient to execute a POST function to return the html data from a webpage. You would only have to provide login credentials if the page you're trying to access is username/password protected. A simple tutorial on this can be found here
http://argillander.wordpress.com/2011/11/23/get-web-page-source-code-in-android/

Recommended way to login to a website through an application

My application has to login to a website by posting a form, and keep track of the cookie provided till the application is terminated.
I have achieved this using the "WebView" class. I have doubts on weather this is the most efficient way to achieve this as I do not wish to display any webpages but Simply submitting another form once logged in.
Is their any other solution/Classes that can handle this with less traffic (smaller footprint)?
You can submit data to the login form just as you can to any other.
Using the HTTP library you can add a payload (of type x-www-form-encoded) to a RequestEntity. The JavaDocs are fairly clear on how to do this.

Android: how to keep the login username stored in the phone as user sending the data to the database server

I've been doing alot of searching around the website but not even sure if i got all the keywords correctly.
I've found this link but I needed more coding samples.
How to keep the session of user login?
I would like more sample coding on keeping the user's info when logged in. As that user sends the data to the server it will identify that user sent that data.
For example, I login as 9999. I send the data 123456789 as a book number to the database server.
the database will show
user-9999 book number 123456789
Another thing I need as sample coding for this similar project is how to input a code to completely logout. As user's cant log out and only their supervisor who knows the code can approve and logout for them by putting in the numbers.
Thanks
Merrill
(I'd post this in a comment, but my account doesn't yet have adequate commenting permissions.)
Are you strictly trying to figure out http session management within the Android app, or are you also trying to figure out session management in a server-side application?

Categories

Resources