Repository: auth0/auth0.js
Pull request #898 (2019-01-21 18:33:37)

Revert "Don't use storage when inside the Universal Login Page"
Reverts auth0/auth0.js#889

I'll open a new PR that fixes this in all methods


Patch:
diff --git a/src/web-auth/index.js b/src/web-auth/index.js
index 221aa90..4438e25 100644
--- a/src/web-auth/index.js
+++ b/src/web-auth/index.js
@@ -653,6 +653,7 @@ 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) {
@@ -660,7 +661,6 @@ 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;
+export default WebAuth;
\ No newline at end of file
diff --git a/src/web-auth/username-password.js b/src/web-auth/username-password.js
index 19597a4..66ac700 100644
--- a/src/web-auth/username-password.js
+++ b/src/web-auth/username-password.js
@@ -33,6 +33,7 @@ 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 1809793..ea24ee9 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 not call transactionManager.process', function(done) {
+    it('should use transactionManager.process', function(done) {
       stub(request, 'post', function() {
-        expect(TransactionManager.prototype.process.calledOnce).to.be(false);
+        expect(TransactionManager.prototype.process.calledOnce).to.be(true);
         done();
       });
 
diff --git a/test/web-auth/web-auth.test.js b/test/web-auth/web-auth.test.js
index a085213..76d885a 100644
--- a/test/web-auth/web-auth.test.js
+++ b/test/web-auth/web-auth.test.js
@@ -2268,6 +2268,7 @@ describe('auth0.WebAuth', function() {
           clientID: '...',
           responseType: 'token',
           redirectUri: 'http://page.com/callback',
+          state: 'randomState',
           connection: 'bar'
         };
         stub(HostedPages.prototype, 'login', function(options, cb) {
@@ -2351,8 +2352,7 @@ 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