Fix: redirect_uri is required in oauth2 code flow, but was null

This commit is contained in:
Sven Luzar
2016-07-01 16:57:32 +02:00
parent 23bb1039b9
commit ce9afa3622
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) {
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 = {
'client_id': clientId,
'code': data.code,
'grant_type': 'authorization_code',
'redirect_uri': redirect_uri
'redirect_uri': redirectUrl
};
if (clientSecret) {

View File

@@ -250,11 +250,19 @@ function clientCredentialsFlow(scopes, tokenUrl, OAuthSchemeKey) {
window.processOAuthCode = function processOAuthCode(data) {
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 = {
'client_id': clientId,
'code': data.code,
'grant_type': 'authorization_code',
'redirect_uri': redirect_uri
'redirect_uri': redirectUrl
};
if (clientSecret) {