Merge pull request #2253 from beemogmbh/master

Fix: redirect_uri is required in oauth2 code flow, but was null
This commit is contained in:
Tony Tam
2016-07-07 08:52:27 -07:00
committed by GitHub
2 changed files with 18 additions and 2 deletions

View File

@@ -250,11 +250,19 @@ function clientCredentialsFlow(scopes, tokenUrl, OAuthSchemeKey) {
window.processOAuthCode = function processOAuthCode(data) { window.processOAuthCode = function processOAuthCode(data) {
var OAuthSchemeKey = data.state; var OAuthSchemeKey = data.state;
// redirect_uri is required in auth code flow
// see https://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.1.3
var host = window.location;
var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
var params = { var params = {
'client_id': clientId, 'client_id': clientId,
'code': data.code, 'code': data.code,
'grant_type': 'authorization_code', 'grant_type': 'authorization_code',
'redirect_uri': redirect_uri 'redirect_uri': redirectUrl
}; };
if (clientSecret) { if (clientSecret) {

View File

@@ -250,11 +250,19 @@ function clientCredentialsFlow(scopes, tokenUrl, OAuthSchemeKey) {
window.processOAuthCode = function processOAuthCode(data) { window.processOAuthCode = function processOAuthCode(data) {
var OAuthSchemeKey = data.state; var OAuthSchemeKey = data.state;
// redirect_uri is required in auth code flow
// see https://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.1.3
var host = window.location;
var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
var params = { var params = {
'client_id': clientId, 'client_id': clientId,
'code': data.code, 'code': data.code,
'grant_type': 'authorization_code', 'grant_type': 'authorization_code',
'redirect_uri': redirect_uri 'redirect_uri': redirectUrl
}; };
if (clientSecret) { if (clientSecret) {