优化
This commit is contained in:
parent
22a90d4158
commit
dfb3f27e7b
@ -12,18 +12,18 @@ import router from "@/router";
|
||||
const configStore = useConfigStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
let discovery = await axios.get(configStore.oauth_discovery_url);
|
||||
const discovery = await axios.get(configStore.oauth_discovery_url);
|
||||
|
||||
let local_code_verifier = localStorage.getItem(configStore.oauth_storage_key);
|
||||
const localCodeVerifier = localStorage.getItem(configStore.oauth_storage_key);
|
||||
|
||||
// 从当前页面请求中获取 code
|
||||
let code = new URLSearchParams(window.location.search).get("code");
|
||||
const code = new URLSearchParams(window.location.search).get("code");
|
||||
|
||||
let q = new URLSearchParams({
|
||||
const q = new URLSearchParams({
|
||||
client_id: configStore.oauth_client_id,
|
||||
grant_type: "authorization_code",
|
||||
redirect_uri: configStore.oauth_callback_url,
|
||||
code_verifier: local_code_verifier || "",
|
||||
code_verifier: localCodeVerifier || "",
|
||||
code: code || "",
|
||||
});
|
||||
|
||||
|
@ -9,11 +9,11 @@ import axios from "axios";
|
||||
import { useConfigStore } from "@/stores/config";
|
||||
const configStore = useConfigStore();
|
||||
|
||||
let discovery = await axios.get(configStore.oauth_discovery_url);
|
||||
const discovery = await axios.get(configStore.oauth_discovery_url);
|
||||
|
||||
function generateRandomString(length: number) {
|
||||
let text = "";
|
||||
let possible =
|
||||
const possible =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
@ -24,7 +24,7 @@ function generateRandomString(length: number) {
|
||||
}
|
||||
|
||||
async function generateCodeChallenge(codeVerifier: string) {
|
||||
let digest = await crypto.subtle.digest(
|
||||
const digest = await crypto.subtle.digest(
|
||||
"SHA-256",
|
||||
new TextEncoder().encode(codeVerifier),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user