-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add transaction manager to passwordlessLogin and login #731
Changes from 4 commits
92f1465
e1c8a4a
905a6a5
f6e2227
f581f88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -1754,7 +1754,8 @@ describe('auth0.WebAuth', function() { | |||
clientID: '...', | ||||
redirectUri: 'http://page.com/callback', | ||||
responseType: 'code', | ||||
_sendTelemetry: false | ||||
_sendTelemetry: false, | ||||
nonce: 'the-nonce' | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You shouldn't be setting the nonce value yourself. The PR description clearly states that what was broken is "state/nonce were not being auto generated". Please DO check that the nonce is present but don't manually set it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this line is already doing some of that auth0.js/test/web-auth/web-auth.test.js Line 27 in f6e2227
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you're right. I switched to id_token since it's the only case where it generates the nonce. |
||||
}); | ||||
}); | ||||
context('when outside of the universal login page', function() { | ||||
|
@@ -1782,7 +1783,12 @@ describe('auth0.WebAuth', function() { | |||
credentialType: 'http://auth0.com/oauth/grant-type/passwordless/otp', | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't seem to find this |
||||
realm: 'sms', | ||||
username: '+55165134', | ||||
otp: '123456' | ||||
otp: '123456', | ||||
clientID: '...', | ||||
responseType: 'code', | ||||
redirectUri: 'http://page.com/callback', | ||||
state: 'randomState', | ||||
nonce: 'the-nonce' | ||||
}; | ||||
stub(CrossOriginAuthentication.prototype, 'login', function(options, cb) { | ||||
expect(options).to.be.eql(expectedOptions); | ||||
|
@@ -1806,7 +1812,12 @@ describe('auth0.WebAuth', function() { | |||
credentialType: 'http://auth0.com/oauth/grant-type/passwordless/otp', | ||||
realm: 'email', | ||||
username: 'the@email.com', | ||||
otp: '123456' | ||||
otp: '123456', | ||||
clientID: '...', | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reading the PR description, what was missing originally was the state/nonce generated values.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We allow people to override most of the options in all most of the methods, that's why I added all the options that you can pass to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright with (1). Solve (2) and I'll approve. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||
responseType: 'code', | ||||
redirectUri: 'http://page.com/callback', | ||||
state: 'randomState', | ||||
nonce: 'the-nonce' | ||||
}; | ||||
stub(CrossOriginAuthentication.prototype, 'login', function(options, cb) { | ||||
expect(options).to.be.eql(expectedOptions); | ||||
|
@@ -1842,9 +1853,14 @@ describe('auth0.WebAuth', function() { | |||
}); | ||||
it('should call `webauth.passwordlessVerify` with phoneNumber', function(done) { | ||||
var expectedOptions = { | ||||
clientID: '...', | ||||
responseType: 'code', | ||||
redirectUri: 'http://page.com/callback', | ||||
connection: 'sms', | ||||
phoneNumber: '+55165134', | ||||
verificationCode: '123456' | ||||
verificationCode: '123456', | ||||
state: 'randomState', | ||||
nonce: 'the-nonce' | ||||
}; | ||||
stub(this.auth0, 'passwordlessVerify', function(options, cb) { | ||||
expect(options).to.be.eql(expectedOptions); | ||||
|
@@ -1865,9 +1881,14 @@ describe('auth0.WebAuth', function() { | |||
}); | ||||
it('should call `webauth.passwordlessVerify` with email', function(done) { | ||||
var expectedOptions = { | ||||
clientID: '...', | ||||
responseType: 'code', | ||||
redirectUri: 'http://page.com/callback', | ||||
connection: 'email', | ||||
email: 'the@email.com', | ||||
verificationCode: '123456' | ||||
verificationCode: '123456', | ||||
state: 'randomState', | ||||
nonce: 'the-nonce' | ||||
}; | ||||
stub(this.auth0, 'passwordlessVerify', function(options, cb) { | ||||
expect(options).to.be.eql(expectedOptions); | ||||
|
@@ -2157,7 +2178,13 @@ describe('auth0.WebAuth', function() { | |||
}); | ||||
|
||||
it('should call CrossOriginAuthentication.login', function(done) { | ||||
var expectedOptions = { foo: 'bar' }; | ||||
var expectedOptions = { | ||||
clientID: '...', | ||||
responseType: 'token', | ||||
redirectUri: 'http://page.com/callback', | ||||
foo: 'bar', | ||||
state: 'randomState' | ||||
}; | ||||
stub(CrossOriginAuthentication.prototype, 'login', function(options, cb) { | ||||
expect(options).to.be.eql(expectedOptions); | ||||
expect(cb()).to.be('cb'); | ||||
|
@@ -2191,7 +2218,13 @@ describe('auth0.WebAuth', function() { | |||
windowHelper.getWindow.restore(); | ||||
}); | ||||
it('calls _hostedPages.login mapping the connection parameter', function(done) { | ||||
var expectedOptions = { connection: 'bar' }; | ||||
var expectedOptions = { | ||||
clientID: '...', | ||||
responseType: 'token', | ||||
redirectUri: 'http://page.com/callback', | ||||
state: 'randomState', | ||||
connection: 'bar' | ||||
}; | ||||
stub(HostedPages.prototype, 'login', function(options, cb) { | ||||
expect(options).to.be.eql(expectedOptions); | ||||
expect(cb()).to.be('cb'); | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are doing the exact same thing on the
WebAuth.prototype.login
method. Maintaining this would be a PITA. Why not moving this to a helper method?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use that a bunch of different places, so I feel this should be tackled in a bigger refactor on how we handle transactions. Tracking: #740