i have developed a wordpress website and I used webview for the android app.
now my concern is that whenever a user log in to the app and opens the app after closing the app.I want to keep them logged in !
I was having the same issue and I solved it by enabling a cache for the App. You might be able to do so by adding this to your Webview instance in MainActivity.java:
//enable in-app cache
myWebView.getSettings().setAppCacheEnabled(true);
Hope this works for you too.
This is to be managed by wordpress side, and not in Android.
two ways either save your user login username and password to sharedprefrence and check it everytime or save your user login username and password to sqlite and check if cursor count is 1 then redirect to webview else type username and password.
cache is no good about security also if user when the close app on ios, the cache gonna be delete
Related
I'm using a simple webView client in my android application, but, when the user log in, close the app and open app again the input forms not save the user information like webbrowser.
How i solve it?
I need when the user enter the 'username' the app save this like a webbrowser, if possible save the password too :)
Thank in advance.
Have you tried following the tutorial on the Android Developer site from Google?. I think that this is what you are looking forward to achieve....
"" Building Apps with Contacts & Sign-In ""
https://developer.android.com/training/building-userinfo.html
Following the Instagram documentation I'm able to authenticate a user and retrieve an access_token easily
But now I want to change of Instagram account which is impossible since the browser automatically call my callback URL because I'm already signed in with an account (there is no login / authorization form again)
To explain what happen here is the authenticate / authorization flow :
Open a browser asking user to log and authorize
User fill up form and submit (this step is skipped when user is already signed in !)
Browser redirect to callback URL
You see step 2 is skipped so we can't login with another user
Does the Instagram have a parameter to force relogin ?
Justin Powell answer is working for log out but I need to be also able to log in just after
and it's quite anoying for Android
But it points me in the right direction : Instagram (like other website) maintains our login with session variable (so with cookies)
So to avoid to be always loged in, we just have to find and remove the correct cookie, here is how to do it with Android :
String cookieString = "sessionid=''";
CookieManager.getInstance().setCookie("instagram.com", cookieString);
With this I set the Instagram sessionid cookie to en empty string so Instagram doesn't recognize me anymore
You could call the Instagram logout url (https://instagram.com/accounts/logout/) in the background before asking for access again. See this question and answers.
I believe the only other option is to leave it up to the user to logout of their Instagram account before loading your access url.
solved the same issue by deleting Access-Token from the app and loading url https://instagram.com/accounts/logout in webview without attaching it to any rootview.
The sdk I am using for my app calls up a webview that loads Facebook's login oauth login screen. I can't find a way of logging the user out so that they can login as a different Facebook user as the view always loads with the credentials of the first user. My only solution is to uninstall the app.
I have been using 'https://graph.facebook.com/me/permissions?method=delete&access_token=', which does in fact remove the user from my app, by I think the webkit cache keeps the last access_token around and just tries to reauthenticate it.
I haven't seen any apps so far that let you fully logout and login as a different user when using Facebook to authenticate.
you can use this at time of logout
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *each in cookieStorage.cookies) {
// put a check here to clear cookie url which starts with twitter and then delete it
if ([[each valueForKey:#"domain"] isEqualToString:#".facebook.com"])
{ [cookieStorage deleteCookie:each]; }
else
{
[cookieStorage deleteCookie:each];
}
}
I'm building an app that is going to be used as a kiosk, with multitudes of people using the same device to log into facebook. I'm clearing the web browser cache which prevents the users from being auto saved and logged in, but the part that I'm unable to figure out is how to keep it from offering username hints in the username box, for users that have logged in via the app. Is there some way to keep it from memorizing usernames and/or displaying the hint in the username input?
TIA
Yep, had much of the same problem myself!
In FbDialog of the facebook sdk(or your implementation):
protected void setUpWebView(int margin) {
...
mWebView.getSettings().setSavePassword(false);
mWebView.getSettings().setSaveFormData(false);
...
}
You should probably already have the .setSavePassword(false) part if your using the latest sdk. (If not, you should definitely add it, there was a big security flaw in fb dialogs)
In my android app I've got the access token (valid, stored/retrieved into/from sharedPref). My question is if it's possible load a facebook page, say http://m.facebook.com/House into a webview as the current user?
It looks like a dark magic that the SDK can pickup the user session and use it in a webview by just doing a simple CookieSyncManager calls in the authorization process. Any idea how to do it in my own webview? thanks!
You just have to fetch cookie from default browser or from account setup & then you just have to send it to your application's web-view.