mirror of
https://github.com/langgenius/dify.git
synced 2026-04-27 02:36:29 +08:00
fix: adjust webapp login token source name
This commit is contained in:
parent
a321d39cb4
commit
6c3804ca49
@ -104,8 +104,8 @@ def decode_enterprise_webapp_user_id(jwt_token: str | None):
|
|||||||
|
|
||||||
decoded = PassportService().verify(jwt_token)
|
decoded = PassportService().verify(jwt_token)
|
||||||
source = decoded.get("token_source")
|
source = decoded.get("token_source")
|
||||||
if not source or source != "enterprise_login":
|
if not source or source != "webapp_login_token":
|
||||||
raise Unauthorized("Invalid token source. Expected 'enterprise_login'.")
|
raise Unauthorized("Invalid token source. Expected 'webapp_login_token'.")
|
||||||
return decoded
|
return decoded
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -110,11 +110,10 @@ class WebAppAuthService:
|
|||||||
exp = int(exp_dt.timestamp())
|
exp = int(exp_dt.timestamp())
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"iss": site.id,
|
|
||||||
"sub": "Web API Passport",
|
"sub": "Web API Passport",
|
||||||
"user_id": account.id,
|
"user_id": account.id,
|
||||||
"end_user_id": end_user_id,
|
"end_user_id": end_user_id,
|
||||||
"token_source": "enterprise_login",
|
"token_source": "webapp_login_token",
|
||||||
"exp": exp,
|
"exp": exp,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user