Skip to content

Commit f3871ce

Browse files
committed
fix getClientFromCookies cannot login
Signed-off-by: ふぁ <yuki@yuki0311.com>
1 parent d9c8a8d commit f3871ce

File tree

1 file changed

+4
-5
lines changed
  • twitter-openapi-typescript/src

1 file changed

+4
-5
lines changed

twitter-openapi-typescript/src/api.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,12 @@ export class TwitterOpenApi {
118118
}
119119

120120
async getClientFromCookies(ct0: string, authToken: string): Promise<TwitterOpenApiClient> {
121-
const cookies: TwitterOpenApiCookie[] = await this.getGuestSession();
122-
[
121+
const guestCookies: TwitterOpenApiCookie[] = await this.getGuestSession();
122+
const cookies = [
123123
{ name: 'auth_token', value: authToken },
124124
{ name: 'ct0', value: ct0 },
125-
]
126-
.filter((e) => cookies.findIndex((c) => c.name == e.name) == -1)
127-
.forEach((e) => cookies.push(e));
125+
];
126+
guestCookies.filter((e) => cookies.findIndex((c) => c.name == e.name) == -1).forEach((e) => cookies.push(e));
128127

129128
const config: i.ConfigurationParameters = {
130129
fetchApi: this.param.fetchApi || fetch,

0 commit comments

Comments
 (0)