Comments (7)
Modifying code and running inside
"this.cordova.getActivity().runOnUiThread(new Runnable() {..."
didn't help
from azure-activedirectory-library-for-cordova.
@CarlosMAguilar - could you please post any simple code snippet which could be used to verify this case?
from azure-activedirectory-library-for-cordova.
hi.
I have reproduced this issue with this considerations:
Phone and OS as follows
Application: multipage (Login page and more modules)
I have done a simple test as follows:
in page 1, invoke with a button:
function testAdal(){ /*test database connection*/ DATABASE_ = window.openDatabase(DATABASE_INTERNAL_NAME_, DATABASE_VERSION_, DATABASE_CAPTION_NAME_, DATABASE_SIZE_); console.log(DATABASE_); //prepare error function var fn_onError = function(e){ console.log(e); }; //call to creation of context Microsoft.ADAL.AuthenticationContext.createAsync("AUTHORITY_URL").then(function(context_){ //aquire token context_.acquireTokenAsync("RESOURCE_URL", "APP_ID", "REDIRECT_URL").then(function (authResponse_) { //token is aquired correctly console.log(authResponse_.accessToken); //navigate to another page App.MoveToURL("Start.html"); }, fn_onError); }, fn_onError); }
I include an image because it can help understand this code (but is just the same).
As you can see, I create context and try to acquire a token. Everything works as expected and this token is printed to console.
So far, everything is fine.
After that, I move to another page, lets say page 2, where I can invoke next function, trying to open database connection:
function testDB(){ DATABASE_ = window.openDatabase(DATABASE_INTERNAL_NAME_, DATABASE_VERSION_, DATABASE_CAPTION_NAME_, DATABASE_SIZE_); console.log(DATABASE_); }
The function fails with the mentioned error. Below is the LogCat output. Note in blue the error and in red the consecuence
I can confirm after some research that this is a common error in authentication plugins with cordova android (facebook for example), none of the forums expose an answer, they just say they "fixed" the plugin and ask users to reinstall/update.
As I said I tried to modify the code at CordovaAdalPlugin.java enclosing the code inside a
`
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
...
`
But this didn't help.
My workaround was to acquire token at login page, save whatever needs to be saved (in order to "save session" and don't ask the user again for the credentials) and restart my app (with a custom call to my own plugin) with code below. This also is Java:
public void RestartApp(){ Intent i = getBaseContext().getPackageManager().getLaunchIntentForPackage( getBaseContext().getPackageName() ); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); finish(); startActivity(i); }
Hope this helps.
from azure-activedirectory-library-for-cordova.
Confirm this issue (stable repro).
from azure-activedirectory-library-for-cordova.
The exact same behavior is reported here but it seems to be already resolved in WebView. But I can still see it in conjunction with ADAL native library as reported above. This might be hard to understand issue cause so you can use the following workarounds to get it working until this is resolved (please also note that websql api is obsoleted and no longer maintained):
- Use https://github.com/litehelpers/Cordova-sqlite-storage plugin. This plugin utilizes SQLite database instead of WebSQL database.
- Override window.openDatabase with own DroidDB_OpenDatabase similar to as it is showed here
from azure-activedirectory-library-for-cordova.
Thanks for your help. I am still looking for a solution but, so far, I am able to bypass with the workaround. I always check over the internet for changes on this, If I get something I will post it here.
from azure-activedirectory-library-for-cordova.
Thanks @CarlosMAguilar
from azure-activedirectory-library-for-cordova.
Related Issues (20)
- Adal not working in windows UWP app (release mode)
- Microsoft CRM on-Premise log in HOT 1
- Unable to get logged in user mail ID
- Do anyone have alternative solution ? HOT 15
- Cannot read property 'constructor' of undefined HOT 1
- IOS12 App+The user is currently prompted for credentials as result of another acquireToken request. Please retry the acquireToken call later HOT 2
- (ADAL) integration with ionic getting “We are unable to issue tokens” , need to use v 2.0 HOT 1
- Back to my Android App. Ionic 4. Need help please. HOT 8
- requireCordovaModule should be changed to require
- iOS 13.2.3 ms adal not redirect on Microsoft sign in page HOT 1
- ms adal cordova plugin for ionic 4 not compatible with cordova 9.0 and ios 13.2 HOT 13
- msadal - acquireTokenSilentAsync doesn't works until "userId" is passed, even it is optional as per docs. HOT 5
- replace the UiWebView with the WkWebView HOT 1
- [iOS] [help Needed] [Objc] new ms-Adal HOT 8
- [IOS] Plugin not working with IOS 13 HOT 1
- iOS archive cordova-plugin-ms-adal-is-back capacitor HOT 4
- Not receiving role from the token response, as roles were declared from azure
- iOS archive cordova-plugin-ms-adal-is-back capacitor HOT 1
- Any capacitor alternative to this plugin?
- getting "ITMS-90809: Deprecated API Usage" error in ionic 3 ios app
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-activedirectory-library-for-cordova.