Merge branch 'develop' of github.com:getinsomnia/insomnia into develop

This commit is contained in:
Gregory Schier 2017-12-28 16:41:38 +01:00
commit da442a73d6
4 changed files with 19 additions and 3 deletions

View File

@ -10,6 +10,7 @@ export const RESPONSE_TYPE_TOKEN = 'token';
export const P_ACCESS_TOKEN = 'access_token';
export const P_CLIENT_ID = 'client_id';
export const P_CLIENT_SECRET = 'client_secret';
export const P_AUDIENCE = 'audience';
export const P_CODE = 'code';
export const P_ERROR = 'error';
export const P_ERROR_DESCRIPTION = 'error_description';

View File

@ -72,7 +72,8 @@ async function _getOAuth2ClientCredentialsHeader (
authentication.credentialsInBody,
authentication.clientId,
authentication.clientSecret,
authentication.scope
authentication.scope,
authentication.audience
);
return _updateOAuth2Token(requestId, results);

View File

@ -12,7 +12,8 @@ export default async function (
credentialsInBody: boolean,
clientId: string,
clientSecret: string,
scope: string = ''
scope: string = '',
audience: string = ''
): Promise<Object> {
const params = [
{name: c.P_GRANT_TYPE, value: c.GRANT_TYPE_CLIENT_CREDENTIALS}
@ -20,6 +21,7 @@ export default async function (
// Add optional params
scope && params.push({name: c.P_SCOPE, value: scope});
audience && params.push({name: c.P_AUDIENCE, value: audience});
const headers = [
{name: 'Content-Type', value: 'application/x-www-form-urlencoded'},

View File

@ -159,6 +159,10 @@ class OAuth2Auth extends React.PureComponent<Props, State> {
this._handleChangeProperty('tokenPrefix', value);
}
_handleChangeAudience (value: string): void {
this._handleChangeProperty('audience', value);
}
_handleChangeGrantType (e: SyntheticEvent<HTMLInputElement>): void {
trackEvent('OAuth 2', 'Change Grant Type', e.currentTarget.value);
this._handleChangeProperty('grantType', e.currentTarget.value);
@ -306,6 +310,13 @@ class OAuth2Auth extends React.PureComponent<Props, State> {
'Change Authorization header prefix from Bearer to something else'
);
const audience = this.renderInputRow(
'Audience',
'audience',
this._handleChangeAudience,
'Indicate what resource server to access'
);
const credentialsInBody = this.renderSelectRow(
'Credentials',
'credentialsInBody',
@ -342,7 +353,8 @@ class OAuth2Auth extends React.PureComponent<Props, State> {
advancedFields = [
scope,
credentialsInBody,
tokenPrefix
tokenPrefix,
audience
];
} else if (grantType === GRANT_TYPE_PASSWORD) {
basicFields = [