Browse files

Ignore "Frame load interrupted" errors in UIWebView

Am writing an OAuth flow using `WebView`, when the OAuth provider redirects back to the [redirect_uri]( I intercept the request using `onShouldStartLoadWithRequest`, get the access token from the url and close the `WebView`.

The problem I see is that when the OAuth provider redirects to the `redirect_uri` and I intercept it by returning false from `onShouldStartLoadWithRequest`, I get a WebKitErrorDomain error code 102 ("Frame load interrupted").

Looking at some other iOS libraries that implement OAuth with a WebView - it seems that the error can be ignored. eg.

You can recreate the error using a url that automatically redirects, eg ->

  source={{ uri: '' }}
  onShouldStartLoadWithRequest={(event) => {
    if (event.url.startsWith('')) {
      return false;
    return true;
Closes #12482

Differential Revision: D5154115

Pulled By: shergin

fbshipit-source-id: 25151d00a1f97e17760617ee5aac6a0140c733c8
  • Loading branch information...
adamjmcgrath authored and facebook-github-bot committed May 31, 2017
1 parent f1284b8 commit 23a34d4c65e55f40d9d8c30773fceff2d9fc4a55
Showing with 8 additions and 0 deletions.
  1. +8 −0 React/Views/RCTWebView.m
@@ -267,6 +267,14 @@ - (void)webView:(__unused UIWebView *)webView didFailLoadWithError:(NSError *)er
if ([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102) {
// Error code 102 "Frame load interrupted" is raised by the UIWebView if
// its delegate returns FALSE from webView:shouldStartLoadWithRequest:navigationType
// when the URL is from an http redirect. This is a common pattern when
// implementing OAuth with a WebView.
NSMutableDictionary<NSString *, id> *event = [self baseEvent];
[event addEntriesFromDictionary:@{
@"domain": error.domain,

0 comments on commit 23a34d4

Please sign in to comment.