给所有请求都加上jwt,隐藏生成jwt的secret(放到.env中),隐藏app-secret(放在pm2运行配置文件中,后续直接读取环境配置即可)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* 2. 如果需要新的网络请求,在 `OAuthClient` 中添加
|
||||
*/
|
||||
import { OAuthClient } from "./oauth-client";
|
||||
import { OAUTH_CONFIG } from "~/config/api-config";
|
||||
import { getServerOAuthConfigRuntime } from "~/config/oauth-secret.server";
|
||||
|
||||
interface TokenInfo {
|
||||
accessToken: string;
|
||||
@@ -29,7 +29,9 @@ export class TokenManager {
|
||||
private oauthClient: OAuthClient;
|
||||
|
||||
constructor() {
|
||||
this.oauthClient = new OAuthClient(OAUTH_CONFIG);
|
||||
// 🔒 安全:使用服务器端专用函数获取包含 clientSecret 的完整配置
|
||||
// 从 .server.ts 文件中运行时读取,确保环境变量正确加载
|
||||
this.oauthClient = new OAuthClient(getServerOAuthConfigRuntime());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user