Skip to content

Commit

Permalink
signIn method should provide using audience prop in userData (#699)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxism committed Jan 27, 2022
1 parent e772c1a commit 8fe9ade
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/auth/PasswordlessAuthenticator.js
Expand Up @@ -104,6 +104,7 @@ class PasswordlessAuthenticator {
* @param {object} userData User credentials object.
* @param {string} userData.username The user's phone number if realm=sms, or the user's email if realm=email
* @param {string} userData.otp The user's verification code. Required
* @param {string} [userData.audience] API Identifier of the API for which you want to get an Access Token.
* @param {string} [userData.realm=sms] Realm string: "sms" or "email".
* @param {string} [userData.password] [DEPRECATED] Password required if using legacy /oauth/ro endpoint
* @param {string} [userData.connection=sms] [DEPRECATED] Connection string: "sms" or "email".
Expand Down
23 changes: 23 additions & 0 deletions test/auth/passwordless.tests.js
Expand Up @@ -465,6 +465,29 @@ describe('PasswordlessAuthenticator', () => {
})
.catch(done);
});

it('should make it possible to use audience property', function (done) {
nock.cleanAll();

const request = nock(API_URL)
.post(path, (body) => body.audience === 'TEST_AUDIENCE')
.reply(200);

this.authenticator
.signIn(
{
...userData,
audience: 'TEST_AUDIENCE',
},
options
)
.then(() => {
expect(request.isDone()).to.be.true;

done();
})
.catch(done);
});
});
});

Expand Down

0 comments on commit 8fe9ade

Please sign in to comment.