Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Commit

Permalink
Merge pull request #186 from salvoravida/dev
Browse files Browse the repository at this point in the history
apiVersion bug fixed with '1.0' compatibility
  • Loading branch information
DarylThayil authored Aug 23, 2019
2 parents 889b2ba + 3a9445d commit ea250d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/authentication-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ var globalCache = new MemoryCache();
* construction of other AuthenticationContexts.
*
*/
function AuthenticationContext(authority, validateAuthority, cache) {
function AuthenticationContext(authority, validateAuthority, cache, aadApiVersion) {
var validate = (validateAuthority === undefined || validateAuthority === null || validateAuthority);

this._authority = new Authority(authority, validate);
this._authority.aadApiVersion = aadApiVersion;
this._oauth2client = null;
this._correlationId = null;
this._callContext = { options : globalADALOptions };
Expand Down
5 changes: 3 additions & 2 deletions lib/oauth2client.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ DEVICE_CODE_RESPONSE_MAP[DeviceCodeResponseParameters.ERROR_DESCRIPTION] = UserC
* @param {string|url} authority An url that points to an authority.
*/
function OAuth2Client(callContext, authority) {
this._aadApiVersion = authority.aadApiVersion === undefined? '1.0' : authority.aadApiVersion;
this._tokenEndpoint = authority.tokenEndpoint;
this._deviceCodeEndpoint = authority.deviceCodeEndpoint;

Expand All @@ -87,7 +88,7 @@ OAuth2Client.prototype._createTokenUrl = function () {
var tokenUrl = url.parse(this._tokenEndpoint);

var parameters = {};
parameters[OAuth2Parameters.AAD_API_VERSION] = '1.0';
parameters[OAuth2Parameters.AAD_API_VERSION] = this._aadApiVersion;

tokenUrl.search = querystring.stringify(parameters);
return tokenUrl;
Expand All @@ -102,7 +103,7 @@ OAuth2Client.prototype._createDeviceCodeUrl = function () {
var deviceCodeUrl = url.parse(this._deviceCodeEndpoint);

var parameters = {};
parameters[OAuth2Parameters.AAD_API_VERSION] = '1.0';
parameters[OAuth2Parameters.AAD_API_VERSION] = this._aadApiVersion;

deviceCodeUrl.search = querystring.stringify(parameters);

Expand Down

0 comments on commit ea250d0

Please sign in to comment.