|
@@ -171,8 +171,8 @@ class SDKServer {
|
|
|
return this.signSession(
|
|
return this.signSession(
|
|
|
{
|
|
{
|
|
|
openId,
|
|
openId,
|
|
|
- appId: ENV.appId,
|
|
|
|
|
- name: options.name || "",
|
|
|
|
|
|
|
+ appId: ENV.appId || "local", // fallback so JWT payload is never empty
|
|
|
|
|
+ name: options.name || openId, // fallback so name is never empty
|
|
|
},
|
|
},
|
|
|
options
|
|
options
|
|
|
);
|
|
);
|
|
@@ -212,19 +212,16 @@ class SDKServer {
|
|
|
});
|
|
});
|
|
|
const { openId, appId, name } = payload as Record<string, unknown>;
|
|
const { openId, appId, name } = payload as Record<string, unknown>;
|
|
|
|
|
|
|
|
- if (
|
|
|
|
|
- !isNonEmptyString(openId) ||
|
|
|
|
|
- !isNonEmptyString(appId) ||
|
|
|
|
|
- !isNonEmptyString(name)
|
|
|
|
|
- ) {
|
|
|
|
|
- console.warn("[Auth] Session payload missing required fields");
|
|
|
|
|
|
|
+ // Only openId is required; appId/name may be empty for local users
|
|
|
|
|
+ if (!isNonEmptyString(openId)) {
|
|
|
|
|
+ console.warn("[Auth] Session payload missing openId");
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
openId,
|
|
openId,
|
|
|
- appId,
|
|
|
|
|
- name,
|
|
|
|
|
|
|
+ appId: typeof appId === "string" ? appId : "",
|
|
|
|
|
+ name: typeof name === "string" ? name : "",
|
|
|
};
|
|
};
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.warn("[Auth] Session verification failed", String(error));
|
|
console.warn("[Auth] Session verification failed", String(error));
|