Repository: auth0/auth0.js
Pull request #593 (2017-12-14 14:57:45)

Release v9.0.0-beta.10


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 091bc95..2619f15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Change Log
 
+## [v9.0.0-beta.10](https://github.com/auth0/auth0.js/tree/v9.0.0-beta.10) (2017-12-14)
+[Full Changelog](https://github.com/auth0/auth0.js/compare/v9.0.0-beta.9...v9.0.0-beta.10)
+# Change Log
+
 ## [v9.0.0-beta.9](https://github.com/auth0/auth0.js/tree/v9.0.0-beta.9) (2017-12-07)
 [Full Changelog](https://github.com/auth0/auth0.js/compare/v9.0.0-beta.8...v9.0.0-beta.9)
 # Change Log
diff --git a/README.md b/README.md
index 726f65b..ab8feec 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ From CDN
 
 ```html
 <!-- Latest patch release -->
-<script src="http://cdn.auth0.com/js/auth0/9.0.0-beta.9/auth0.min.js"></script>
+<script src="http://cdn.auth0.com/js/auth0/9.0.0-beta.10/auth0.min.js"></script>
 ```
 
 From [npm](https://npmjs.org)
diff --git a/package.json b/package.json
index 7bdda51..a242bda 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "auth0-js",
-  "version": "9.0.0-beta.9",
+  "version": "9.0.0-beta.10",
   "description": "Auth0 headless browser sdk",
   "main": "src/index.js",
   "keywords": [
diff --git a/src/authentication/index.js b/src/authentication/index.js
index 23ccd74..9addefd 100644
--- a/src/authentication/index.js
+++ b/src/authentication/index.js
@@ -390,7 +390,7 @@ Authentication.prototype.getSSOData = function(withActiveDirectories, cb) {
           name: ssodataInformation.lastUsedConnection
         },
         lastUsedUserID: result.idTokenPayload.sub,
-        lastUsedUsername: result.idTokenPayload.name || result.idTokenPayload.email,
+        lastUsedUsername: result.idTokenPayload.email || result.idTokenPayload.name,
         lastUsedClientID: clientId,
         sessionClients: [clientId],
         sso: true
diff --git a/src/version.js b/src/version.js
index e20c050..62e205c 100644
--- a/src/version.js
+++ b/src/version.js
@@ -1,1 +1,1 @@
-module.exports = { raw: '9.0.0-beta.9' };
+module.exports = { raw: '9.0.0-beta.10' };


Test patch:
diff --git a/test/authentication/authentication.test.js b/test/authentication/authentication.test.js
index cb0fd27..b817517 100644
--- a/test/authentication/authentication.test.js
+++ b/test/authentication/authentication.test.js
@@ -314,7 +314,9 @@ describe('auth0.authentication', function() {
         error_description: 'foobar'
       });
     });
-    it('returns ssoData object with lastUsedConnection and idtokenpayload.name', function(done) {
+    it('returns ssoData object with lastUsedConnection and idtokenpayload.name when there is no idtokenpayload.email', function(
+      done
+    ) {
       this.auth0.getSSOData(function(err, result) {
         expect(err).to.be(null);
         expect(result).to.be.eql({
@@ -332,7 +334,7 @@ describe('auth0.authentication', function() {
         idTokenPayload: { sub: 'the-user-id', name: 'last-used-user-name' }
       });
     });
-    it('returns ssoData object with lastUsedConnection and idtokenpayload.email when there is no name', function(
+    it('returns ssoData object with lastUsedConnection and idtokenpayload.email by default', function(
       done
     ) {
       this.auth0.getSSOData(function(err, result) {
@@ -349,7 +351,7 @@ describe('auth0.authentication', function() {
       });
 
       this.webAuthSpy.checkSession.lastCall.args[1](null, {
-        idTokenPayload: { sub: 'the-user-id', email: 'last-used-user-email' }
+        idTokenPayload: { sub: 'the-user-id', email: 'last-used-user-email', name: 'do not use me' }
       });
     });
   });