I am new to phonegap development and currently developing an app that will run on android, i-phone and on windows phone. But getting problem in handling session from phonegap app - I got few post here on stack overflow but that was only for iphone using appDelegate.m defining cookie storage and also I got few post for only android storing session in HttpClient object coded in java - but is there anything on phonegap side to handle session - because then we can use the same code for all 3 devices ( iphone, android, windows ).
Probably I may sounds some sort of odd but I am really undecided as can't find any clue how to maintain the session and how to use the same session on consecutive calls to serverside script for gettinf different session specific information.
Is there any common way to achieve this that I may missed. Any help is highly appreciated. Thanks in advance.
With Regards,
Supriyo
Unless I misunderstood you, HTML5's localStorage is the way to go.
It is implemented in Phonegap, as described here: http://docs.phonegap.com/en/1.7.0/cordova_storage_storage.md.html#localStorage
This one works for me.
var CheckboxValue=$("#rememberme").is("checked");
if (CheckboxValue== true)
{
var username = $("#user").val();
var password = $("#pass").val();
window.localStorage.setItem("username", username);
window.localStorage.setItem("password", password);
}
Related
I want to create user at Mesibo but i am facing some issues :
Sorry, we can't find that page It seems the page you’re looking for doesn’t exist. Maybe you’re on the wrong track, maybe you found a broken link. Who knows?
Please anyone here to help related to these issues and also help to complete my this task and I am using following URL for creating a user at "Mesibo".
"https://mesibo.com/api/api.php?token=cn9cvk6gnm15e7lrjb2k7ggggax5h90n5x7dp4sam6kwitl2hmg4cmwabet4zgdw&op=useradd&appid=com.mesibo.demoapp&addr=18005550001"
token = Application Token
appid = Android or iOS app id (for example, com.mesibo.xxx). In case of web, just pass, ‘web’ as appid. Note that, for security reasons, the token generated for a particular appid will only be usable on app matching that appid.
addr = end point address, for example, a user phone number.
Thanks
Instead of "https://mesibo.com/api/api.php?..." use "https://api.mesibo.com/api.php?token=..."
As we know, there have been changes in access to the twitter API referring to callbacks URLs.
So far, I have been using the identification callback with firebase, as I indicated here:
This has been working perfectly so far.
I read in the documentation that now you have to indicate the callback, according to android or iOS in the following way:
twitterkit- : // if using Twitter Kit for iOS or
twittersdk: // if using Twitter Kit for Android.
My application is only developed for android.
I have tried all the possible variants, but I always get the following error:
The client application failed validation: Not a valid callback URL format.
The tested options have been:
twittersdk://pfa89MGYola62VIln ........ (MY_CONSUMER_KEY)
twittersdk://MY_APP-android.firebaseapp.com/__/auth/handler
twittersdk://https://MY_APP-android.firebaseapp.com/__/auth/handler
I have activated and deactivated the check "enable callback locking" ...
I've tried everything, I'm a little desperate
For another test, I tried to register the URL callback as if it were the iOS platform
twitterkit-MY_CONSUMER_KEY://
and it was accepted on the first attempt.
I do not mind losing the relationship with firebase, the truth is that I was not using it, but I have a serious problem if I can not connect with twitter again.
I appreciate any help.
I found the solution, I put it here in case it can be of help to someone.
The truth is that it is not well specified in the documentation, you have to take two steps.
First: activate the "enable callback locking" checkbox
Second: indicate the android sdk for twitter, WITHOUT CONSUMER KEY, unlike iOS users.
It would be like this:
I hope it helps
I'm trying to create a little mobile app with ionic and a wordpress (and JSON API) for backend.
I choose cookie auth for log people. This méthode work perfectly in my web browser thanks but when I use "phonegap serve" or apk directly on my phone nothing happen.
According to following lines $cookies.put(...) seems not working on my Android device.
console.log("Cookie: ");
$cookies.put(data['cookie_name'],data['cookie']);
console.log($cookies.getAll());
Have you some idea to resolve my problem ?
Thank you
You can't use cookies, you should use localStorage.
To set the localstorage:
window.localStorage.setItem("key", "value");
To retrieve localstorage:
var value = window.localStorage.getItem("key");
To remove particular localstorage:
window.localStorage.removeItem("key");
To clear all localstorage:
window.localStorage.clear();
For your reference, you can use this link.
I am sure, this will help you.
Building my first app with PhoneGap Build but cannot solve a problem which is, of course, an important piece.
The app uses Google oAuth2 to access an external site where I fetch data with Ajax. I use a url to do the initial login.
The only way I can get back to the Google Sign In is to delete and reinstall the app in iOS. In Android, I can use Application Manage and Clear Data.
In both cases, I get asked for the Sign In again as desired if I take either of those manual steps.
How can I programmatically clear the oAuth2 data which I believe is causing the problem?
Or, if necessary, what can I do to reinitialize the app entirely?
Thanks in advance for your suggestions.
Got this to work for me:
function googLogout (){
var ref = window.open('https://accounts.google.com/Logout?continue=http://google.com', '_blank', 'hidden=yes');
setTimeout(function(){ref.close();}, 3000);
alert('goog logout done');
}
Hope it helps someone else.
I'm going nuts over here! I've got a website I am making in CakePHP that will form the back end of a mobile application. It is not a mobile website, it's designed purely to be used for a smartphone application.
That being said: The application needs the user to login. But I just cannot seem to find the right way to implement this. The BasicAuthenticate AuthComponent seems to hate me and doesn't make debugging easy. There's an OAuth 2.0 Provider plugin for CakePHP 2.0, but I can't figure out how to make it 2 legged, as the app won't be relying on the website to display a login form.
I really need to figure out which of these paths to take and how to make it work but just neither one wants to work. Anybody have any info on what I need to do?
Update The Basic Auth issue turned out to be due to Virtualmin preferring to use FCGId to allow the process to run as the same owner as the content of the website. I have since switched it back to mod_php and it works fine.
So my question is now more about using cakephp-oauth-server in a 2 legged setup.
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('index','view');
$this->set('logged_in', $this->Auth->loggedIn());
$this->set('current_user',$this->Auth->user());
if($this->name == 'Specific') {
// for the specific controller
$this->Auth->authenticate = array('Basic');
} else {
// everything else
}
}
checkout KVZ's rest plugin it may be of interest https://github.com/kvz/cakephp-rest-plugin