Skip to content

Commit 6b52a19

Browse files
feat: accept api_token as an alias for token in sf login (#265)
The CLI session polling endpoint returns the auth JWT under the `token` field today. Accept `api_token` as a fallback so the CLI stays compatible if the field is renamed server-side.
1 parent 29c0c12 commit 6b52a19

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/lib/login.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,17 @@ async function getSession({ token }: { token: string }) {
9797
},
9898
});
9999

100-
return response.data as {
100+
// The auth JWT is returned as `token` today; accept `api_token` as a
101+
// fallback so the CLI is forward-compatible with a server-side rename.
102+
const data = response.data as {
101103
validation?: string;
102104
token?: string;
105+
api_token?: string;
106+
};
107+
108+
return {
109+
validation: data.validation,
110+
token: data.token ?? data.api_token,
103111
};
104112
} catch (error) {
105113
console.error("Error getting session:", error);

0 commit comments

Comments
 (0)