This is only happening on IOS, on android I'm getting expected behavior.
I have this property on my web view from react-native-webview
onNavigationStateChange={(e) => {
if (e?.url.includes(TOKEN_QUERY_PARAM)) {
let startIndex = e.url.indexOf(TOKEN_QUERY_PARAM);
let token = e.url.substring(startIndex + TOKEN_QUERY_PARAM.length);
authorize(token);
}
}}
As you can see, the webview will send me a link with a token that I can then send to my authorize function to get my user signed into the app. This works the first time the app is used but then begins caching the same call/response if you do it again. Its working as it should on android, but on ios the authorize function is returning the same information from the last time it was called.
Has anyone experienced anything like this? I tried setting all the different cache properties on the webview to be false and it still doesnt work. Any ideas??
Related
I am following the WeChat Login documentation for Android and it works but only once and I can't repeat the process.
I use this code to get the access token code:
IWXAPI api = WXAPIFactory.createWXAPI(this, APP_ID, false);
SendAuth.Req request = new SendAuth.Req();
request.scope = "snsapi_userinfo";
request.state = "wechat_sdk_demo_test";
api.sendReq(request);
I have created the WXEntryActivty and I received the response from the WeChat app and I can finish the login process.
But if I reinstall my app and try to login with WeChat again I always get ERR_BAN (-6) error code. To make it work again I have to reinstall the WeChat app.
I could't find anything about when can I get ERR_BAN error code in the documentation. Can anyone help me with this problem?
I had many problems using Wechat API and testing directly on wechat app on my phone due to CACHE.
It's very difficult to flush wechat cache, i would say almost impossible, that's why you have to re install wechat to start your tests again.
I highly suggest you to use the desktop testing app for wechat, download it here, links are in the end of the page:
https://mp.weixin.qq.com/wiki?action=doc&id=mp1455784140
Then you will be able to debug every step of your development AND flush cache. Additionally you can link the software to your phone and debug what happens inside wechat web browser.
I managed to solve the problem. I copied the MD5 signature directly from the keytool's output which is contains colons :. I removed the colons from the signature and now it works correctly.
I think this is a bug in the WeChat app because the signature works with colons when the app displays the authorization page but not after that.
I am trying to integrate reCaptcha with my Ionic Android/IOS app. The reason for this is that it calls the same API as the public Web app API.
I have tried creating a web key but due to the fact that the app is served from file:// it doesn't have a domain and as such i cant white list it.
I also tried to create a Android key and white list the App's package name but in both cases, i get the same error:
"error for site owner invalid domain for site key"
I tried using these recaptcha angular wrappers: ng-recaptcha and angular2-recaptcha, but obviously they fail as is a domain issue.
Is there any way to go around this?
So, after long searches and reading everything i found on the subject, i managed to find a workaround.
Instead of trying to load the captcha in my Ionic app, i am using the in-app-browser to open a page on our web version of the app that has the captcha. When the captcha is checked, it saves the code in the localStorage of the in-app-browser.
When the browser is initially opened i start running a script on the browser that checks its storage for the captchaCode.
Code example:
captchaCheck($event){
const browser = this.iab.create(YOUR_CAPTCHA_PAGE_URL_HERE,'_blank', 'location=no'); //AppSettings.CAPTCHA_URL
let loginCtx = this;
browser.on( "loadstop").subscribe(function() {
browser.executeScript({ code: "localStorage.setItem( 'captchaCode', '' );" });
var loop = setInterval(function() {
browser.executeScript({code: "localStorage.getItem( 'captchaCode' )"}).then((values)=>{
var captchaCode = values[0];
if (captchaCode) {
loginCtx.signinForm.get('captchaCode').setValue(captchaCode);
clearInterval( loop );
browser.close();
}
});
});
});
}
}
I have a Laravel application with login.
It all works fine in a browser, but if I use Android WebView, and try to login, I get an error
Trying to get property of non-object
This is because, when I try and get the user with Auth::user(); it returns null.
I am logging my user in using auth()->login($user) in a function. If I dd($user) at this step, it does get the correct user - but then I redirect into /dashboard which then fires a function, where the first thing it does is to try and get the user.
Its at this point it breaks.
This all works in a browser - also in an android browser. But not in Webview.
Can this have anything to do with the session cookie or something? Is it possible to try and dd() the session cookie to see if it exists?
And if it doesn't, how come this isn't setting in Android Webview?
I have tried using CookieManager.getInstance().setAcceptCookie(true); but this isn't helping, and should also be defined by default.
All help appreciated
I'm building a meteorjs app and deploying it as a native (cordova) app for Android and iOS.
I need to deep link to my app, so I can launch it by following a link on a website.
I've implemented URL Scheme using the cordova plugin by Eddy Verbruggen (https://github.com/EddyVerbruggen/Custom-URL-scheme) and I managed to get my app launched by following a link of the "myapp://" format.
The problem is that, even though the app is getting successfully launched, the handleOpenUrl hook is not getting triggered.
Meteor.startup(function() {
handleOpenURL = function handleOpenURL(url) {
console.log("received url: " + url);
// parse url and proceed accordingly
}
});
Nothing gets logged. So I have no way of passing any parameters to my app, or even detect that the app was launched via a link that follows the 'myapp://' URL scheme.
Also, I noticed that even though my app is already open, if I switch to the browser and click on a special "myapp://" link, instead of switching to my (already open) app, a new instance of the app is getting launched.
[edit] Turned out the two problems were related. Once I prevented a new instance of the app from being initialized, the handleOpenUrl function was triggered successfully.
I'm using the Android emulator for all my tests. I haven't had the chance to test on iOS yet.
[edit] iOS didn't give this problem at all. It was only an Android problem.
If anyone out there has any experience on implementing custom URL scheme in meteorjs, your feedback is much appreciated!
I managed to fix the issue I was facing. Here is the solution, for anybody else who is facing similar problems.
First of all, it was only occurring on Android. iOS had no problem whatsoever to launch the app and trigger the handleOpenUrl function.
The two issues that I was facing on Android turned out that there were related to each other. The fact that a new instance of the app was triggered every time, prevented the handleOpenUrl function from being triggered.
Both problems were fixed by adding a single line of code on the mobile-config.js file:
App.setPreference("AndroidLaunchMode", "singleTask");
So I've created a simple WebView application that wraps an already existing mobile friendly site and displays it on the device. I've enabled javascript, supported screen orientation changes, etc...
I've run into an issue with the oAuth support though. Accessing the site from the chrome browser on the device, everything runs fine.
If I try to access the site from the app/WebView, it will push me over to the oAuth screen, let me input credentials and everything, but the moment it tries to push me back to the website and log me in, I get this:
Failed to recognize URL query:
https://exittix.com/frontend/login/redirect.html#access_token=******************************&expires_in=********&state=****client_id=******************network*****facebook*****display***popup****callback****_hellojs_agj27sx5****state****oauth_proxy***https***auth-server.herokuapp.com%2Fproxy***scope***basic_profile***email***basic***oauth***version***auth***https***facebook.com%2Foauth***
The * is used to protect data.
So, any ideas why oAuth isn't working inside a JS enabled webview but works fine in the mobile chrome browser for android?
Thanks in advance for your help!
EDIT:
Ok, so I've tracked the error I'm getting back to redirect.html.
This page calls some javascript. If the javascript fails to redirect, then it displays that error I have above instead.
The javascript being called to handle the oAuth is Andrew Dodson's hello.js script.
You can see it HERE.
I've concluded that the second half of the error's url is indeed the unhandled JSON.
Here's what the returned data looks like after I've decoded it from the URL encoded characters:
{"client_id":"************.apps.googleusercontent.com","network":"google","display":"popup","callback":"_hellojs_********","state":"","oauth_proxy":"https://auth-server.herokuapp.com/proxy","scope":["https://www.googleapis.com/auth/userinfo.profile","https://www.googleapis.com/auth/userinfo.email","basic"],"oauth":{"version":2,"auth":"https://accounts.google.com/o/oauth2/auth"}}&access_token=***.*.*****_*********************************************************&token_type=Bearer&expires_in=3600
Any ideas why this isn't getting handled properly in the WebView?