Merge pull request #2253 from beemogmbh/master
Fix: redirect_uri is required in oauth2 code flow, but was null
This commit is contained in:
10
dist/lib/swagger-oauth.js
vendored
10
dist/lib/swagger-oauth.js
vendored
@@ -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) {
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user