I'm still a newbie in the mobile app development arena, please forgive me if I did not provide adequate information, probably because my lack of knowledge on its relevance. I'll edit with more info upon request.
Here's what I'm using to build my app on a Windows 7 64bit environment:
AngularJS 1.0
Phonegap Build 6.3.0 (cloud version)
cordova-android 5.2.1 (as shown on Phonegap build)
cordova-ios 4.2.0 (as shown on Phonegap build)
azure-activedirectory-library-for-cordova version 0.7.1
I'm testing on:
Android phone Samsung Galaxy SCH-I545 os version 5.0.1
iPhone 6S Plus os version 9.3.5
Everything went well with Android using ADAL plugin 0.7.1. However on iPhone, it kept going back to the login screen for authentication to our AD FS even though I already got authenticated the first time. I'm suspecting the token did not get stored in cache, that's why acquireTokenAsync kept getting called? I'm still trying to get my hands on a MAC to troubleshoot further.
Then, I updated to ADAL plugin 0.8.0 to see if that might solve my problem, but now Android stopped working and I got this error:
DEVELOPER_AUTHORITY_IS_NOT_VALID_INSTANCE
I debugged through using developer tool on both 0.7.1 and 0.8.0 and I saw no token coming back in acquireTokenAsync method in version 0.8.0. Switching back to 0.7.1 and Android works again.
Could anyone guide me on what might be causing this problem on my iPhone and Android? Maybe I'm missing additional settings or files? The way I updated the ADAL plugin was replacing the cordova-plugin-ms-adal folder under plugins and modify my config.xml file to spec="~0.8.0", that should be sufficient right?
* Update on cordova-android *
I finally got 0.8.0 working on my android device by turning off validateAuthority
var context = new Microsoft.ADAL.AuthenticationContext(authority,false);
I think it's because I'm using AD FS (found this comment in ADErrorCodes.h under adal-for-objc):
/*! The passed in authority URL does not pass validation, if you're trying to use ADFS directly you must disable authority validation. */
/*! An error was raised during the process of validating the authorization authority. */
AD_ERROR_DEVELOPER_AUTHORITY_VALIDATION = 101
* Update on cordova-ios *
Debugging in Safari developer tool, I don't have tokenCacheItems after the native method got called.
bridge.executeNativeMethod('tokenCacheReadItems',[this.authContext.authority, this.authContext.validateAuthority])
.then(function (tokenCacheItems) {
tokenCacheItems.forEach(function (item) {
result.push(new TokenCacheItem(item));
});
d.resolve(result);
}, function(err) {
d.reject(err);
});
I spent almost a week on this already and I really appreciate any help on this issue.
Related
Hello: I'm trying to get started with the ADAL plug-in for Cordova. Having used the native libraries a few times, I thought this would be pretty straightforward but I ran into a bit of an issue.
First of all my environment is VS2017, and the plugin is ADAL for Cordova 0.10.1.
I've created what I believe is the most simplistic example of a connection, using my own client application specifics and the ones provided in their sample online (which is) included below. My authentication looks like:
function authenticate(authCompletedCallback, errorCallback) {
var authority = "https://login.microsoftonline.com/common",
redirectUri = "http://localhost:4400",
resourceUri = "https://graph.windows.net",
clientId = "a5d92493-ae5a-4a9f-bcbf-9f1d354067d3";
var authContext = new Microsoft.ADAL.AuthenticationContext(authority);
authContext.acquireTokenAsync(resourceUri, clientId, redirectUri).then(authCompletedCallback, errorCallback);
This is then called in onDeviceReady();
acquireTokenAsync is called but doesn't appear to return either success or failure and a quick Fiddler trace doesn't appear to show the call which makes me wonder if it is not a configuration issue with Cordova to begin with.
I have commented out the Content-Security-Policy metatag with similar results.
Thank you in advance for any guidance!
Edit
Okay, perhaps this is helpful. I noticed that on the Cordova Plugin Simulation tab (I am trying to run this in the simulator in Chrome). I am seeing a dialog box with error:
There is no handler for the following exec call:
ADALProxy.acquireTokenAsync(...
Also, seems to work on a connected Android Device, just not in the local Simulator
The plug-in for Cordova doesn't support to run on the browser platform. When we developer an Cordova app and want to test on the browser platform, we have to ensure that the app depends on support the browser platform.
For the ADAL plug-in for Cordova support the platform:
Android (OS 4.0.3 and higher)
iOS Windows (Windows 8.0, Windows 8.1,
Windows 10 and Windows Phone 8.1)
And for other kinds of plug-in you can check it via you the Cordova plug-in.
We are developing app for iOS and Android and we are using Ti.Gelocation to getCurrentPosition and then set the Region of the MapView of ti.map module.
The app is already on marketplace and downloaded, so we are developing an important upgrade with this new feature. We dont't have problem with Android platform, but with iOS version of the app we get a several error invoking Ti.Geolocation module
The error on iOS 9.x on iPad and iPhone (we have no test on iPod) is:
-[__NSCFString containsObject:] unrecognized selector sent to instance 0x1463d500 at GeoView.js (line xxxx)
This error happens with the project with it.vocami.vocamiapp app-id, in the test project (ap-id=it.vocami.vocamitest) that we use for research and test of new features, no error happens and all run good. When we add at every level of our code (in the first row too), for example, Ti.Geolocation.locationServiceEnabled, in the main vocamiapp project, we get the error.
We have tried all we could think but at the end, if we change the app-id, the code runs otherwise we get the error. We cannot change the app-id because we need to update our published app.
We are developing with AppceleratorStudio version 4.5.0.021602170281 and Ti SDK ver 5.2.0GA on Mac OS X 10.10.5.
I just recently was "hit" by the fact that when I made my app ready for Google Play I use a specific key/user to sign it with. That behaves differently from just running it locally on the phone.
I had to make sure that I had registered two certificates with Google's API in the developer console. It didn't give me exactly the message that you show - but wouldn't show the map with a location. And the way I read the location prior to showing it on the map led me in the wrong direction looking at permissions on Android first :-)
/John
I am stuck at this from few days. I installed the phonegap plugin for twilio client (by Jeff Linwood) to a fresh phonegap app. Copied the headers, library file to xcode project from twilio ios sdk as mentioned in instructions.
But when i run the test app, it gives me following error:
2014-12-14 12:30:42.940 TestApp[1802:14622] THREAD WARNING:
['TCPlugin'] took '221.611084' ms. Plugin should use a background
thread. 2014-12-14 12:30:42.941 TestApp[1802:14622] PJSIP(1):
pjsua_acc.c .Unable to create/send REGISTER: Object is busy
(PJSIP_EBUSY) [status=171001] 2014-12-14 12:30:43.947
TestApp[1802:14622] State: Offline 2014-12-14 12:30:45.727
TestApp[1802:14777] PJSIP(2): pjsua_acc.c ....SIP registration
failed, status=302 (Moved Temporarily) 2014-12-14 12:30:45.734
TestApp[1802:14777] PJSIP(1): pjsua_acc.c .....Unable to
create/send REGISTER: Object is busy (PJSIP_EBUSY) [status=171001]
Tested with following :
Xcode v 6.1.1/iOS 8.1 and XCode 5.1.1/iOS 7.1 (both alternatively)
Phonegap version : 4.1.2-0.22.9 and 3.6.3-0.22.3 (both alternatively)
Cordova iOS 4.1.2 and 3.7.0 (both alternatively)
Twilio iOS Client SDK 1.2
If you need any more info please feel free to ask.
Please suggest me if i am doing anything wrong.
It would be great if someone can help me to go through this.
Regards.
Without some code sample it's hard to say for certain, but as mentioned it looks like there are multiple connect calls being made.
Looking at the source it appears that the "deviceSetup" command will start a connection, so if you are manually calling the "connect" command after setting up the device it will likely cause that warning. Feel free to post some more sample code if that doesn't work.
Hope that helps!
I have upgraded my Xcode 4.4, Phonegap to Cordova 1.9 and installed the Sharekit 2.0 and I cannot get ShareKit to work. Prior to upgrading, ShareKit v.021 worked properly -except the known issues with that old version
I installed ShareKit 2.0 as per the WIKI. I then updated the ShareKit plugin as per these directions
My ios app is completely html, css, and js. I call ShareKit via javascript with the following commands:
shareToFacebook(msg, url) and shareToTwitter(msg, url)
In the simulator, I get the following error and I have no idea how to fix it. I inherited this project and I am a newbie, so I am flying a little blind.
2012-09-21 16:38:29.744 mcs[3976:17603] Assertion failure in +[SHK sharersDictionary], /Users/Main/Documents/ShareKit/ShareKit/Classes/ShareKit/Core/SHK.m:528*
**2012-09-21 16:38:29.745 mcs[3976:17603] WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: ShareKit: You do not have properly set sharersPlistName***
I have the defaul SHKSharers.plist in my project with the 9 services still enabled though. I had only twitter and facebook and I got the same errors.
Any help would be greatly appreciated.
In your custom SHKConfigurator file add this:
- (NSString*)sharersPlistName {
return #"SHKSharers.plist";
}
SHKSharers.plist is default one comes with ShareKit. You can have one of your own. But make sure you return your plist name in sharersPlistName function.
From my extensive reading, the iOS 5.1 localStorage/WebSQL behavior change that Apple instituted has been fully rolled into Cordova 1.6.0.
However, while running on my (new) application on Cordova 1.7.0 and iOS 5.1.1, I am still seeing ugly, incorrect behavior.
I use window.localStorage to store and retrieve data. E.g.
window.localStorage.getItem("activeFormId")
window.localStorage.setItem("activeFormId", formId);
These work flawlessly during the same session of the Cordova-based app. If I background the app with the main iOS button then resume, that usually works as well.
However, the moment I kill the application (double-tap, long-press, tap the red circle) and relaunch, all localStorage data is lost. I have verified this with jsconsole.com as well.
Are there additional steps I need to take to ensure the persistence bug fixes are working? Any help is greatly appreciated.
Try using 1.7 - I had a similar issue and once I upgraded to 1.7 everything worked like it used to.
Try using localStorage vs window.localStorage syntax.
Also set what ever you're trying to call as a global variable...
var globalVar;
function onDeviceReady(){
globalVar = localStorage.getItem('something');
}