Skip to content

Commit

Permalink
Updates for WKWebView edit
Browse files Browse the repository at this point in the history
  • Loading branch information
alexziskind1 committed Mar 25, 2018
1 parent 0722b80 commit 177741a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tns-oauth-webview-helper.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export class TnsOAuthWebViewHelper extends NSObject implements WKNavigationDeleg


public webViewDecidePolicyForNavigationActionDecisionHandler(webView, navigationAction, decisionHandler) {
//decisionHandler(WKNavigationActionPolicy.Allow);
this._checkCodeIntercept(webView, null);
this._origDelegate.webViewDecidePolicyForNavigationActionDecisionHandler(webView, navigationAction, decisionHandler);
}

Expand Down
5 changes: 4 additions & 1 deletion tns-oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export function loginViaAuthorizationCodeFlow(credentials: TnsOAuthModule.ITnsOA
return new Promise((resolve, reject) => {
var navCount = 0;

let hasCode = false;

let checkCodeIntercept = (webView, error, url): boolean => {
var retStr = '';
try {
Expand Down Expand Up @@ -134,7 +136,8 @@ export function loginViaAuthorizationCodeFlow(credentials: TnsOAuthModule.ITnsOA
let qsObj = querystring.parse(parsedRetStr.query);
let codeStr = qsObj['code'] ? qsObj['code'] : qsObj['xsrfsign'];
let errSubCode = qsObj['error_subcode'];
if (codeStr) {
if (codeStr && !hasCode) {
hasCode = true;
try {
getTokenFromCode(credentials, codeStr)
.then((response: TnsOAuthModule.ITnsOAuthTokenResult) => {
Expand Down

0 comments on commit 177741a

Please sign in to comment.