Skip to content

Commit

Permalink
Updated authorizeCodeGrant function name
Browse files Browse the repository at this point in the history
Changed the function name to authorizationCodeGrant for all usages and comments
  • Loading branch information
cwurtz committed Aug 8, 2018
1 parent 980bc79 commit 73bcd13
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/auth/OAuthAuthenticator.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ OAuthAuthenticator.prototype.clientCredentialsGrant = function(options, cb) {
/**
* Sign in using an authorization code
*
* @method authorizeCodeGrant
* @method authorizationCodeGrant
* @memberOf module:auth.OAuthAuthenticator.prototype
*
* @example <caption>
Expand All @@ -266,7 +266,7 @@ OAuthAuthenticator.prototype.clientCredentialsGrant = function(options, cb) {
* client_secret: '{CLIENT_SECRET}', // Optional field.
* };
*
* auth0.oauth.authorizeCodeGrant(data, function (err, userData) {
* auth0.oauth.authorizationCodeGrant(data, function (err, userData) {
* if (err) {
* // Handle error.
* }
Expand All @@ -280,7 +280,7 @@ OAuthAuthenticator.prototype.clientCredentialsGrant = function(options, cb) {
*
* @return {Promise|undefined}
*/
OAuthAuthenticator.prototype.authorizeCodeGrant = function(options, cb) {
OAuthAuthenticator.prototype.authorizationCodeGrant = function(options, cb) {
var params = {
type: 'token'
};
Expand Down
24 changes: 12 additions & 12 deletions test/auth/oauth.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('OAuthAuthenticator', function() {
});

describe('instance', function() {
var methods = ['signIn', 'socialSignIn', 'passwordGrant', 'authorizeCodeGrant'];
var methods = ['signIn', 'socialSignIn', 'passwordGrant', 'authorizationCodeGrant'];
var authenticator = new Authenticator(validOptions);

methods.forEach(function(method) {
Expand Down Expand Up @@ -675,7 +675,7 @@ describe('OAuthAuthenticator', function() {
});
});

describe('#authorizeCodeGrant', function() {
describe('#authorizationCodeGrant', function() {
var path = '/oauth/token';
var data = {
code: 'auth_code',
Expand All @@ -690,33 +690,33 @@ describe('OAuthAuthenticator', function() {
});

it('should require an object as first argument', function() {
expect(this.authenticator.authorizeCodeGrant).to.throw(
expect(this.authenticator.authorizationCodeGrant).to.throw(
ArgumentError,
'Missing options object'
);
});

it('should require a code', function() {
var auth = this.authenticator;
var signIn = auth.authorizeCodeGrant.bind(auth, { redirect: API_URL });
var signIn = auth.authorizationCodeGrant.bind(auth, { redirect: API_URL });

expect(signIn).to.throw(ArgumentError, 'code field is required');
});

it('should require a redirect_uri', function() {
var auth = this.authenticator;
var signIn = auth.authorizeCodeGrant.bind(auth, { code: 'auth_code' });
var signIn = auth.authorizationCodeGrant.bind(auth, { code: 'auth_code' });

expect(signIn).to.throw(ArgumentError, 'redirect_uri field is required');
});

it('should accept a callback', function(done) {
this.authenticator.authorizeCodeGrant(data, done.bind(null, null));
this.authenticator.authorizationCodeGrant(data, done.bind(null, null));
});

it('should return a promise when no callback is provided', function(done) {
this.authenticator
.authorizeCodeGrant(data)
.authorizationCodeGrant(data)
.then(done.bind(null, null))
.catch(done.bind(null, null));
});
Expand All @@ -725,7 +725,7 @@ describe('OAuthAuthenticator', function() {
var request = this.request;

this.authenticator
.authorizeCodeGrant(data)
.authorizationCodeGrant(data)
.then(function() {
expect(request.isDone()).to.be.true;

Expand All @@ -750,7 +750,7 @@ describe('OAuthAuthenticator', function() {
.reply(200);

this.authenticator
.authorizeCodeGrant(data)
.authorizationCodeGrant(data)
.then(function() {
expect(request.isDone()).to.be.true;

Expand All @@ -769,7 +769,7 @@ describe('OAuthAuthenticator', function() {
.reply(200);

this.authenticator
.authorizeCodeGrant(data)
.authorizationCodeGrant(data)
.then(function() {
expect(request.isDone()).to.be.true;

Expand All @@ -788,7 +788,7 @@ describe('OAuthAuthenticator', function() {
.reply(200);

this.authenticator
.authorizeCodeGrant(data)
.authorizationCodeGrant(data)
.then(function() {
expect(request.isDone()).to.be.true;

Expand All @@ -807,7 +807,7 @@ describe('OAuthAuthenticator', function() {
.reply(200);

this.authenticator
.authorizeCodeGrant(data)
.authorizationCodeGrant(data)
.then(function() {
expect(request.isDone()).to.be.true;

Expand Down

0 comments on commit 73bcd13

Please sign in to comment.