Skip to content
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

signIn method should provide using audience prop in userData #699

Merged
merged 1 commit into from Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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