Android webview - Set token to post request -
i have problem webview in app.
i need set token in order connected automatically.
to that, added header first loading page , each loading pages shouldoverrideurlloading method.
so here code :
final map<string, string> extraheaders = new hashmap<>(); extraheaders.put("authorization", "bearer " + accesstoken); webview.getsettings().setjavascriptenabled(true); webview.setwebviewclient(new webviewclient() { @override public boolean shouldoverrideurlloading(webview view, string url) { extraheaders.put("authorization", "bearer " + accesstoken); view.loadurl(url, extraheaders); return super.shouldoverrideurlloading(view, url); }
}
this code works : automatically authenticated first display , next pages inside webview.
on other side, have problem form. when submit form, redirected login page and, because set token each page, redirected home page of site.
the token not set when submit request post done.
do have idea?
thanks
Comments
Post a Comment