mirror of
https://github.com/ysoftdevs/oauth-playground-client.git
synced 2026-07-02 19:11:36 +02:00
Config extracted
This commit is contained in:
@@ -151,15 +151,15 @@
|
|||||||
</main>
|
</main>
|
||||||
<footer class="page-footer"></footer>
|
<footer class="page-footer"></footer>
|
||||||
<script src="../js/load-layout.js"></script>
|
<script src="../js/load-layout.js"></script>
|
||||||
|
<script src="../js/env-config.js"></script>
|
||||||
<script>
|
<script>
|
||||||
const tokenEndpoint = 'https://www.sso.oauth-playground.online/auth/token';
|
const tokenEndpoint = baseUrl + "/token";
|
||||||
const clientID = 'oauth-playground';
|
|
||||||
const code = new URLSearchParams(window.location.search).get('code');
|
const code = new URLSearchParams(window.location.search).get('code');
|
||||||
|
|
||||||
function fillRequestExample() {
|
function fillRequestExample() {
|
||||||
const requestExample =
|
const requestExample =
|
||||||
"grant_type=authorization_code" + "\n"
|
"grant_type=authorization_code" + "\n"
|
||||||
+ "&client_id=" + clientID + "\n"
|
+ "&client_id=" + getClientId() + "\n"
|
||||||
+ "&redirect_uri=" + getRedirectUri() + "\n"
|
+ "&redirect_uri=" + getRedirectUri() + "\n"
|
||||||
+ "&code=" + code;
|
+ "&code=" + code;
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@
|
|||||||
|
|
||||||
$("#tokenUrl").text(tokenEndpoint);
|
$("#tokenUrl").text(tokenEndpoint);
|
||||||
$("#grantType").text("authorization_code");
|
$("#grantType").text("authorization_code");
|
||||||
$("#clientId").text(clientID);
|
$("#clientId").text(getClientId());
|
||||||
$("#redirectUri").text(getRedirectUri());
|
$("#redirectUri").text(getRedirectUri());
|
||||||
$("#code").text(code);
|
$("#code").text(code);
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
|
|
||||||
const bodyData = new URLSearchParams();
|
const bodyData = new URLSearchParams();
|
||||||
bodyData.append('grant_type', 'authorization_code');
|
bodyData.append('grant_type', 'authorization_code');
|
||||||
bodyData.append('client_id', clientID);
|
bodyData.append('client_id', getClientId());
|
||||||
bodyData.append('redirect_uri', getRedirectUri());
|
bodyData.append('redirect_uri', getRedirectUri());
|
||||||
bodyData.append('code', code);
|
bodyData.append('code', code);
|
||||||
|
|
||||||
|
|||||||
+4
-5
@@ -118,6 +118,7 @@
|
|||||||
</main>
|
</main>
|
||||||
<footer class="page-footer"></footer>
|
<footer class="page-footer"></footer>
|
||||||
<script src="../js/load-layout.js"></script>
|
<script src="../js/load-layout.js"></script>
|
||||||
|
<script src="../js/env-config.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function generateSessionState () {
|
function generateSessionState () {
|
||||||
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
||||||
@@ -126,7 +127,7 @@
|
|||||||
function constructRequestUrl () {
|
function constructRequestUrl () {
|
||||||
return baseUrl
|
return baseUrl
|
||||||
+ "?" + "response_type=" + responseType
|
+ "?" + "response_type=" + responseType
|
||||||
+ "&" + "client_id=" + clientId
|
+ "&" + "client_id=" + getClientId()
|
||||||
+ "&" + "redirect_uri=" + redirectUri
|
+ "&" + "redirect_uri=" + redirectUri
|
||||||
+ "&" + "scope=" + scope
|
+ "&" + "scope=" + scope
|
||||||
+ "&" + "state=" + state;
|
+ "&" + "state=" + state;
|
||||||
@@ -135,7 +136,7 @@
|
|||||||
function fillExample() {
|
function fillExample() {
|
||||||
const requestExample = baseUrl + "\n"
|
const requestExample = baseUrl + "\n"
|
||||||
+ " ?response_type=" + responseType + "\n"
|
+ " ?response_type=" + responseType + "\n"
|
||||||
+ " &client_id=" + clientId + "\n"
|
+ " &client_id=" + getClientId() + "\n"
|
||||||
+ " &redirect_uri=" + redirectUri + "\n"
|
+ " &redirect_uri=" + redirectUri + "\n"
|
||||||
+ " &scope=" + scope + "\n"
|
+ " &scope=" + scope + "\n"
|
||||||
+ " &state=" + state;
|
+ " &state=" + state;
|
||||||
@@ -143,7 +144,7 @@
|
|||||||
$("#requestUriExample").text(requestExample);
|
$("#requestUriExample").text(requestExample);
|
||||||
$("#baseUrl").text(baseUrl);
|
$("#baseUrl").text(baseUrl);
|
||||||
$("#responseType").text(responseType);
|
$("#responseType").text(responseType);
|
||||||
$("#clientId").text(clientId);
|
$("#clientId").text(getClientId());
|
||||||
$("#redirectUri").text(redirectUri);
|
$("#redirectUri").text(redirectUri);
|
||||||
$("#scope").text(scope);
|
$("#scope").text(scope);
|
||||||
$("#state").text(state);
|
$("#state").text(state);
|
||||||
@@ -153,9 +154,7 @@
|
|||||||
return window.location.protocol + "//" + window.location.host + "/flow/code-2";
|
return window.location.protocol + "//" + window.location.host + "/flow/code-2";
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseUrl = "https://www.sso.oauth-playground.online/auth";
|
|
||||||
const responseType = "code";
|
const responseType = "code";
|
||||||
const clientId = "oauth-playground";
|
|
||||||
const redirectUri = getRedirectUri();
|
const redirectUri = getRedirectUri();
|
||||||
const scope = "offline_access";
|
const scope = "offline_access";
|
||||||
const state = generateSessionState();
|
const state = generateSessionState();
|
||||||
|
|||||||
@@ -134,6 +134,7 @@
|
|||||||
<footer class="page-footer"></footer>
|
<footer class="page-footer"></footer>
|
||||||
<script src="../js/load-layout.js"></script>
|
<script src="../js/load-layout.js"></script>
|
||||||
<script src="../js/cookies.js"></script>
|
<script src="../js/cookies.js"></script>
|
||||||
|
<script src="../js/env-config.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function generateSessionState () {
|
function generateSessionState () {
|
||||||
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
||||||
@@ -142,7 +143,7 @@
|
|||||||
function constructRequestUrl () {
|
function constructRequestUrl () {
|
||||||
return baseUrl
|
return baseUrl
|
||||||
+ "?" + "response_type=" + responseType
|
+ "?" + "response_type=" + responseType
|
||||||
+ "&" + "client_id=" + clientId
|
+ "&" + "client_id=" + getClientId()
|
||||||
+ "&" + "redirect_uri=" + redirectUri
|
+ "&" + "redirect_uri=" + redirectUri
|
||||||
+ "&" + "scope=" + scope
|
+ "&" + "scope=" + scope
|
||||||
+ "&" + "state=" + state
|
+ "&" + "state=" + state
|
||||||
@@ -153,7 +154,7 @@
|
|||||||
function fillExample() {
|
function fillExample() {
|
||||||
const requestExample = baseUrl + "\n"
|
const requestExample = baseUrl + "\n"
|
||||||
+ " ?response_type=" + responseType + "\n"
|
+ " ?response_type=" + responseType + "\n"
|
||||||
+ " &client_id=" + clientId + "\n"
|
+ " &client_id=" + getClientId() + "\n"
|
||||||
+ " &redirect_uri=" + redirectUri + "\n"
|
+ " &redirect_uri=" + redirectUri + "\n"
|
||||||
+ " &scope=" + scope + "\n"
|
+ " &scope=" + scope + "\n"
|
||||||
+ " &state=" + state + "\n"
|
+ " &state=" + state + "\n"
|
||||||
@@ -163,7 +164,7 @@
|
|||||||
$("#requestUriExample").text(requestExample);
|
$("#requestUriExample").text(requestExample);
|
||||||
$("#baseUrl").text(baseUrl);
|
$("#baseUrl").text(baseUrl);
|
||||||
$("#responseType").text(responseType);
|
$("#responseType").text(responseType);
|
||||||
$("#clientId").text(clientId);
|
$("#clientId").text(getClientId());
|
||||||
$("#redirectUri").text(redirectUri);
|
$("#redirectUri").text(redirectUri);
|
||||||
$("#scope").text(scope);
|
$("#scope").text(scope);
|
||||||
$("#state").text(state);
|
$("#state").text(state);
|
||||||
@@ -175,9 +176,7 @@
|
|||||||
return window.location.protocol + "//" + window.location.host + "/flow/pkce-3";
|
return window.location.protocol + "//" + window.location.host + "/flow/pkce-3";
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseUrl = "https://www.sso.oauth-playground.online/auth";
|
|
||||||
const responseType = "code";
|
const responseType = "code";
|
||||||
const clientId = "oauth-playground";
|
|
||||||
const redirectUri = getRedirectUri();
|
const redirectUri = getRedirectUri();
|
||||||
const scope = "offline_access";
|
const scope = "offline_access";
|
||||||
const state = generateSessionState();
|
const state = generateSessionState();
|
||||||
|
|||||||
@@ -165,16 +165,16 @@
|
|||||||
<footer class="page-footer"></footer>
|
<footer class="page-footer"></footer>
|
||||||
<script src="../js/load-layout.js"></script>
|
<script src="../js/load-layout.js"></script>
|
||||||
<script src="../js/cookies.js"></script>
|
<script src="../js/cookies.js"></script>
|
||||||
|
<script src="../js/env-config.js"></script>
|
||||||
<script>
|
<script>
|
||||||
const tokenEndpoint = 'https://www.sso.oauth-playground.online/auth/token';
|
const tokenEndpoint = baseUrl + "/token";
|
||||||
const clientID = 'oauth-playground';
|
|
||||||
const code = new URLSearchParams(window.location.search).get('code');
|
const code = new URLSearchParams(window.location.search).get('code');
|
||||||
const codeVerifier = getCookie("code_verifier");
|
const codeVerifier = getCookie("code_verifier");
|
||||||
|
|
||||||
function fillRequestExample() {
|
function fillRequestExample() {
|
||||||
const requestExample =
|
const requestExample =
|
||||||
"grant_type=authorization_code" + "\n"
|
"grant_type=authorization_code" + "\n"
|
||||||
+ "&client_id=" + clientID + "\n"
|
+ "&client_id=" + getClientId() + "\n"
|
||||||
+ "&redirect_uri=" + getRedirectUri() + "\n"
|
+ "&redirect_uri=" + getRedirectUri() + "\n"
|
||||||
+ "&code=" + code + "\n"
|
+ "&code=" + code + "\n"
|
||||||
+ "&code_verifier=" + codeVerifier;
|
+ "&code_verifier=" + codeVerifier;
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
|
|
||||||
$("#tokenUrl").text(tokenEndpoint);
|
$("#tokenUrl").text(tokenEndpoint);
|
||||||
$("#grantType").text("authorization_code");
|
$("#grantType").text("authorization_code");
|
||||||
$("#clientId").text(clientID);
|
$("#clientId").text(getClientId());
|
||||||
$("#redirectUri").text(getRedirectUri());
|
$("#redirectUri").text(getRedirectUri());
|
||||||
$("#code").text(code);
|
$("#code").text(code);
|
||||||
$("#codeVerifier").text(codeVerifier);
|
$("#codeVerifier").text(codeVerifier);
|
||||||
@@ -199,7 +199,7 @@
|
|||||||
|
|
||||||
const bodyData = new URLSearchParams();
|
const bodyData = new URLSearchParams();
|
||||||
bodyData.append('grant_type', 'authorization_code');
|
bodyData.append('grant_type', 'authorization_code');
|
||||||
bodyData.append('client_id', clientID);
|
bodyData.append('client_id', getClientId());
|
||||||
bodyData.append('redirect_uri', getRedirectUri());
|
bodyData.append('redirect_uri', getRedirectUri());
|
||||||
bodyData.append('code', code);
|
bodyData.append('code', code);
|
||||||
bodyData.append('code_verifier', codeVerifier);
|
bodyData.append('code_verifier', codeVerifier);
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
const baseUrl = "https://www.sso.oauth-playground.online/auth";
|
||||||
|
|
||||||
|
function getClientId() {
|
||||||
|
if (window.location.hostname === "localhost") {
|
||||||
|
return "oauth-playground-localhost";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "oauth-playground";
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user