You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Martin Birkby (JIRA)" <ji...@apache.org> on 2017/12/13 14:44:00 UTC

[jira] [Updated] (CB-13676) InAppBrowser event.url is always lowercase

     [ https://issues.apache.org/jira/browse/CB-13676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Birkby updated CB-13676:
-------------------------------
    Description: 
Hi,

Trying to implement OAuth for a custom OAuth provider. The token that is returned contains Base64 encoded information which is lost as the event.url from the InAppBrowser amends the redirect url to lowercase. In this case the redirect url has ;token=<token> appended to it. The below code replicates...

public secureDataLogin(): Promise<any> {

      return new Promise(function(resolve, reject) {

          let csrf: string = uuid.v4();
          var url = 'http://111.111.11.111:8080/auth/oauth/2' + '?response_type=token&csrf=' + csrf + '&redirect_uri=' +  'http://www.google.com' + '&scope=profile&client_id=a1aaaaaa-123a-132a-1a11-ab12345678ab';
          var browserRef = window.cordova.InAppBrowser.open(url, "_blank", "location=no");

          browserRef.addEventListener("loadstart", (event) => {

              if ((event.url).indexOf('http://www.google.com') === 0) {
                  browserRef.removeEventListener("exit", (event) => {});
                  browserRef.close();
                  
                  // would decode and process the token data here

                  console.log(event.url);
              }
          });
          browserRef.addEventListener("loaderror", (event) => {
            console.log('*ERROR*' + event.type + ' - ' + event.message);
          });
          browserRef.addEventListener("exit", function(event) {
            console.log("Browser exit called");
          });
      });
  }

Cheers
Martin

  was:
Hi,

Trying to implement OAuth for a custom OAuth provider. The token that is returned contains Base64 encoded information which is lost as the event.url from the InAppBrowser amends the redirect url to lowercase. In this case the redirect url has ;token=<token> appended to it. The below code replicates...

public secureDataLogin(): Promise<any> {

      return new Promise(function(resolve, reject) {

          let csrf: string = uuid.v4();
          sessionStorage.setItem('csrf', csrf);
          var url = 'http://111.111.11.111:8080/auth/oauth/2' + '?response_type=token&csrf=' + csrf + '&redirect_uri=' +  'http://www.google.com' + '&scope=profile&client_id=a1aaaaaa-123a-132a-1a11-ab12345678ab';
          var browserRef = window.cordova.InAppBrowser.open(url, "_blank", "location=no");

          browserRef.addEventListener("loadstart", (event) => {

              if ((event.url).indexOf('http://www.google.com') === 0) {
                  browserRef.removeEventListener("exit", (event) => {});
                  browserRef.close();
                  
                  // would decode and process the token data here

                  console.log(event.url);
              }
          });
          browserRef.addEventListener("loaderror", (event) => {
            console.log('*ERROR*' + event.type + ' - ' + event.message);
          });
          browserRef.addEventListener("exit", function(event) {
            console.log("Browser exit called");
          });
      });
  }

Cheers
Martin


> InAppBrowser event.url is always lowercase
> ------------------------------------------
>
>                 Key: CB-13676
>                 URL: https://issues.apache.org/jira/browse/CB-13676
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-inappbrowser
>         Environment: osx 10.13, xcode 9.2, cordova-ios@4.5.1, cordova-plugin-device@1.1.4, cordova-plugin-inappbrowser@1.7.2, cordova-plugin-ionic-webview@1.1.16, cordova-plugin-whitelist@1.3.1
>            Reporter: Martin Birkby
>
> Hi,
> Trying to implement OAuth for a custom OAuth provider. The token that is returned contains Base64 encoded information which is lost as the event.url from the InAppBrowser amends the redirect url to lowercase. In this case the redirect url has ;token=<token> appended to it. The below code replicates...
> public secureDataLogin(): Promise<any> {
>       return new Promise(function(resolve, reject) {
>           let csrf: string = uuid.v4();
>           var url = 'http://111.111.11.111:8080/auth/oauth/2' + '?response_type=token&csrf=' + csrf + '&redirect_uri=' +  'http://www.google.com' + '&scope=profile&client_id=a1aaaaaa-123a-132a-1a11-ab12345678ab';
>           var browserRef = window.cordova.InAppBrowser.open(url, "_blank", "location=no");
>           browserRef.addEventListener("loadstart", (event) => {
>               if ((event.url).indexOf('http://www.google.com') === 0) {
>                   browserRef.removeEventListener("exit", (event) => {});
>                   browserRef.close();
>                   
>                   // would decode and process the token data here
>                   console.log(event.url);
>               }
>           });
>           browserRef.addEventListener("loaderror", (event) => {
>             console.log('*ERROR*' + event.type + ' - ' + event.message);
>           });
>           browserRef.addEventListener("exit", function(event) {
>             console.log("Browser exit called");
>           });
>       });
>   }
> Cheers
> Martin



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org