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

apiVersion bug fixed with '1.0' compatibility #186

Merged
merged 1 commit into from
Aug 23, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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