Repository: auth0/auth0.js
Pull request #889 (2019-01-08 21:45:41)

Don't use storage when inside the Universal Login Page
fix https://github.com/auth0/auth0.js/issues/882


Patch:
diff --git a/src/web-auth/index.js b/src/web-auth/index.js
index 4438e25..221aa90 100644
--- a/src/web-auth/index.js
+++ b/src/web-auth/index.js
@@ -653,7 +653,6 @@ WebAuth.prototype.login = function(options, cb) {
       'nonce'
     ])
     .with(options);
-  params = this.transactionManager.process(params);
 
   var isHostedLoginPage = windowHelper.getWindow().location.host === this.baseOptions.domain;
   if (isHostedLoginPage) {
@@ -661,6 +660,7 @@ WebAuth.prototype.login = function(options, cb) {
     delete params.realm;
     this._universalLogin.login(params, cb);
   } else {
+    params = this.transactionManager.process(params);
     this.crossOriginAuthentication.login(params, cb);
   }
 };
@@ -794,4 +794,4 @@ WebAuth.prototype.passwordlessVerify = function(options, cb) {
   });
 };
 
-export default WebAuth;
\ No newline at end of file
+export default WebAuth;
diff --git a/src/web-auth/username-password.js b/src/web-auth/username-password.js
index 66ac700..19597a4 100644
--- a/src/web-auth/username-password.js
+++ b/src/web-auth/username-password.js
@@ -33,7 +33,6 @@ UsernamePassword.prototype.login = function(options, cb) {
       'audience'
     ])
     .with(options);
-  body = this.transactionManager.process(body);
 
   body = objectHelper.toSnakeCase(body, ['auth0Client']);
 


Test patch:
diff --git a/test/web-auth/hosted-pages.test.js b/test/web-auth/hosted-pages.test.js
index ea24ee9..1809793 100644
--- a/test/web-auth/hosted-pages.test.js
+++ b/test/web-auth/hosted-pages.test.js
@@ -132,9 +132,9 @@ describe('auth0.WebAuth._universalLogin', function() {
         }
       );
     });
-    it('should use transactionManager.process', function(done) {
+    it('should not call transactionManager.process', function(done) {
       stub(request, 'post', function() {
-        expect(TransactionManager.prototype.process.calledOnce).to.be(true);
+        expect(TransactionManager.prototype.process.calledOnce).to.be(false);
         done();
       });
 
diff --git a/test/web-auth/web-auth.test.js b/test/web-auth/web-auth.test.js
index 76d885a..a085213 100644
--- a/test/web-auth/web-auth.test.js
+++ b/test/web-auth/web-auth.test.js
@@ -2268,7 +2268,6 @@ describe('auth0.WebAuth', function() {
           clientID: '...',
           responseType: 'token',
           redirectUri: 'http://page.com/callback',
-          state: 'randomState',
           connection: 'bar'
         };
         stub(HostedPages.prototype, 'login', function(options, cb) {
@@ -2352,7 +2351,8 @@ describe('auth0.WebAuth', function() {
           error_description: "responseType can't be `code`"
         });
       });
-    });it('throws an error if redirectUri is empty', function() {
+    });
+    it('throws an error if redirectUri is empty', function() {
       this.auth0.checkSession({ redirectUri: '' }, function(err) {
         expect(err).to.be.eql({
           error: 'error',
@@ -2569,4 +2569,4 @@ describe('auth0.WebAuth', function() {
       webAuth.validateToken('token', 'nonce', function() {});
     });
   });
-});
\ No newline at end of file
+});