mirror of
https://github.com/ysoftdevs/oauth-playground-client.git
synced 2026-01-11 22:41:29 +01:00
Redirection fixes
This commit is contained in:
@@ -145,13 +145,19 @@
|
||||
+ "&" + "state=" + state;
|
||||
}
|
||||
|
||||
function getRedirectUri() {
|
||||
return window.location.protocol + "//" + window.location.host + "/flow/code-2";
|
||||
}
|
||||
|
||||
const baseUrl = "https://sso.rumbuddy.cz/realms/OAuthPlayground/protocol/openid-connect/auth";
|
||||
const responseType = "code";
|
||||
const clientId = "oauth-playground";
|
||||
const redirectUri = "http://localhost:5555/flow/code-2";
|
||||
const redirectUri = getRedirectUri();
|
||||
const scope = "offline_access";
|
||||
const state = generateSessionState();
|
||||
|
||||
console.debug(window.location);
|
||||
|
||||
$("#sendRequestBtn").attr("href", constructRequestUrl());
|
||||
|
||||
$("#baseUrl").text(baseUrl);
|
||||
|
||||
@@ -102,29 +102,32 @@
|
||||
$(".page-footer").load("../layout/footer.html");
|
||||
$("#page-header").load("../layout/header.html");
|
||||
|
||||
const tokenEndpoint = 'https://sso.rumbuddy.cz/realms/OAuthPlayground/protocol/openid-connect/token';
|
||||
const clientID = 'oauth-playground';
|
||||
const code = new URLSearchParams(window.location.search).get('code');
|
||||
|
||||
function fillRequestExample() {
|
||||
const requestExample =
|
||||
"POST https://sso.rumbuddy.cz/realms/OAuthPlayground/protocol/openid-connect/token?" + "\n\n"
|
||||
+ "grant_type=authorization_code" + "\n"
|
||||
+ "&client_id=oauth-playground" + "\n"
|
||||
+ "&redirect_uri=http://localhost:5555/flow/code-2" + "\n"
|
||||
+ "&code=--Vto71vecBQbZnbA7ErehWHVQq4x1pm5YtA9Rr7x5zjhMGS";
|
||||
+ "&client_id=" + clientID + "\n"
|
||||
+ "&redirect_uri=" + getRedirectUri() + "\n"
|
||||
+ "&code=" + code;
|
||||
|
||||
$("#requestExample").text(requestExample);
|
||||
}
|
||||
|
||||
function getToken() {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const code = urlParams.get('code');
|
||||
function getRedirectUri() {
|
||||
return window.location.protocol + "//" + window.location.host + "/flow/code-2";
|
||||
}
|
||||
|
||||
const tokenEndpoint = 'https://sso.rumbuddy.cz/realms/OAuthPlayground/protocol/openid-connect/token';
|
||||
const clientID = 'oauth-playground';
|
||||
const redirectURI = 'http://localhost:5555/flow/code-2';
|
||||
function getToken() {
|
||||
const redirectURI = getRedirectUri();
|
||||
|
||||
const bodyData = new URLSearchParams();
|
||||
bodyData.append('grant_type', 'authorization_code');
|
||||
bodyData.append('client_id', clientID);
|
||||
bodyData.append('redirect_uri', redirectURI);
|
||||
bodyData.append('redirect_uri', getRedirectUri());
|
||||
bodyData.append('code', code);
|
||||
|
||||
fetch(tokenEndpoint, {
|
||||
|
||||
Reference in New Issue
Block a user