just a reminder: webviewclient's onPageFinished() method
"is called only for main frame" (android documentation).
you've got something going on with that redirect of yours.
my guess is that's the page you're waiting for to trigger your
auth key extraction. it's possible onPageFinished() is never
called for the page that is loaded as a result of a redirection.
if you've tested this and know for a fact that it works, i stand
corrected. otherwise, you need to isolate that very first
loadurl() and wait for(), and see if the redirection fires an
onPageFinshed() (or _pagefinished in b4a). you might only
get the initial page (which means your app will never succeed).
you might - just might - get 2 _pagefinished events! that means
you have to ignore the first one and wait for the second.
if you notice in your login sub, you
don't do 2 important things:
1) you never actually log the url that triggers the _pagefinished event. so you don't know what you got.
2) you do an "If Url.Contains("
https://login.microsoftonline.com/common/oauth2/nativeclient") Then...", but you don't do an "else". here again, you leave yourself blind. if the url doesn't contain something you're looking for, what
does it contain? you don't bother toask...
i think you need to see how many _pagefinished events you get and what the url is that is passsed by the event(s).