Use the correct main.html file
This commit is contained in:
parent
6fe2119fc3
commit
9b364cd21d
|
@ -10,19 +10,21 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function oauth() {
|
function oauth() {
|
||||||
// Function to parse URL parameters
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
function getUrlParameter(name) {
|
|
||||||
name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
|
|
||||||
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
|
|
||||||
var results = regex.exec(location.search);
|
|
||||||
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
||||||
};
|
|
||||||
|
|
||||||
// Get URL parameters
|
// Get URL parameters
|
||||||
var client_id = getUrlParameter('client_id');
|
var client_id = urlParams.get('client_id');
|
||||||
var redirect_uri = getUrlParameter('redirect_uri');
|
var redirect_uri = urlParams.get('redirect_uri');
|
||||||
var response_type = getUrlParameter('response_type');
|
var response_type = urlParams.get('response_type');
|
||||||
var state = getUrlParameter('state');
|
var state = urlParams.get('state');
|
||||||
|
|
||||||
|
if (urlParams.has('code_challenge')) {
|
||||||
|
code = urlParams.get('code_challenge');
|
||||||
|
codemethod = urlParams.get('code_challenge_method');
|
||||||
|
} else {
|
||||||
|
code = "none"
|
||||||
|
codemethod = "none"
|
||||||
|
}
|
||||||
|
|
||||||
// Get DONOTSHARE-secretkey from localStorage
|
// Get DONOTSHARE-secretkey from localStorage
|
||||||
var secret_key = localStorage.getItem("DONOTSHARE-secretkey");
|
var secret_key = localStorage.getItem("DONOTSHARE-secretkey");
|
||||||
|
@ -30,7 +32,9 @@
|
||||||
// Create data object to send
|
// Create data object to send
|
||||||
var data = {
|
var data = {
|
||||||
appId: client_id,
|
appId: client_id,
|
||||||
secretKey: secret_key
|
secretKey: secret_key,
|
||||||
|
code: code,
|
||||||
|
codemethod: codemethod
|
||||||
};
|
};
|
||||||
|
|
||||||
// Send data to example.org using POST request
|
// Send data to example.org using POST request
|
||||||
|
|
Reference in New Issue