fix: 修复clogin登录丢失state问题

This commit is contained in:
xiaojunnuo
2026-05-14 23:44:04 +08:00
parent 90ba55c043
commit 22f5cfcfd8
8 changed files with 23 additions and 38 deletions
@@ -82,14 +82,22 @@ export class ConnectController extends BaseController {
const bindUrl = installInfo?.bindUrl || "";
//构造登录url
const redirectUrl = `${bindUrl}api/oauth/callback/${body.type}`;
let stateObj = {
forType: body.forType || 'login',
}
const state = utils.hash.base64(JSON.stringify(stateObj))
const { loginUrl, ticketValue } = await oauthProvider.addon.buildLoginUrl({
redirectUri: redirectUrl,
forType: body.forType,
from: body.from || "web",
subtype: body.subtype,
state,
});
const ticket = this.codeService.setValidationValue({
...ticketValue,
state,
subtype: body.subtype,
})
this.ctx.cookies.set("oauth_ticket", ticket, {