简体   繁体   中英

How can I authenticate users via my android app for a web service?

I need users to be able to log in to a web service from my app.

Of course I could use an HTTP Post to push the strings to the login page, but wouldn't the user have to click "Sign in" on the app to pass the strings and again on the web service to ACTUALLY login?

I have three guesses. - Could I get the objects from the web service and push them back? - Could I pass the strings to the web service and log in without having to select "sign in" again on that page(essentially, could I pass fields to the web service and "click" the web Sign In button onClick)? - Or could I tweak the webview enough to only display what I want the user to see (username and password fields and sign in button)?

I would prefer assistance with the syntax of my second guess (How can I pass the fields and "click" Sign In OnClick?) but any advice is greatly appreciated.
Thank You,
Chris

Since you're using both a web-based login and webservices, you should consider a solution like OAuth . Basically, a user logs in via the web and gets a user token. That user token can then be used to call subsequent web services.

There's a bit of back and forth that goes on between the client and the web server, but it provides a robust method that big names like Facebook and Twitter use, so you know it's a good option.

http://en.wikipedia.org/wiki/OAuth

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM