Skip to content

Commit 2ff63dd

Browse files
committed
fix: immediete sign out on newer versions of twitter
1 parent 0137ae5 commit 2ff63dd

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

twitterv1/auth.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,22 @@ func access_token(c *fiber.Ctx) error {
7272
Timestamp: time.Now(),
7373
})
7474

75-
return c.SendString(fmt.Sprintf("oauth_token=%s&oauth_token_secret=%s&user_id=%s&screen_name=%s&x_auth_expires=0", oauth_token, oauth_token, fmt.Sprintf("%d", bridge.BlueSkyToTwitterID(res.DID)), url.QueryEscape(authUsername)))
75+
return c.SendString(fmt.Sprintf("oauth_token=%s&oauth_token_secret=%s&user_id=%s&screen_name=%s&x_auth_expires=0", oauth_token, oauth_token, fmt.Sprintf("%d", bridge.BlueSkyToTwitterID(res.DID)), url.QueryEscape(authUsername))) // TODO: make this the actual screenname
7676
} else if authMode == "exchange_auth" {
77-
return c.SendStatus(200) // uuuuuuuuh idk what this responds. I'll figure it out later.
77+
return c.Status(fiber.StatusUnauthorized).SendString("i have no idea what this should respond with, but it works if i don't have it implemented, so thats what im doing.")
78+
// this is a hack
79+
// auth_header := "oauth_token=\"" + c.FormValue("x_auth_access_secret") + "\""
80+
// c.Request().Header.Set("Authorization", auth_header)
81+
// my_did, pds, _, oauth_token, err := GetAuthFromReq(c)
82+
// if err != nil {
83+
// return c.Status(fiber.StatusUnauthorized).SendString("Unauthorized")
84+
// }
85+
// authenticating_user, err := blueskyapi.GetUserInfo(*pds, *oauth_token, *my_did, true)
86+
// if err != nil {
87+
// return c.Status(fiber.StatusInternalServerError).SendString("Failed to fetch user info")
88+
// }
89+
90+
// return c.SendString(fmt.Sprintf("oauth_token=%s&oauth_token_secret=%s&user_id=%s&screen_name=%s&x_auth_expires=0", *oauth_token, *oauth_token, fmt.Sprintf("%d", bridge.BlueSkyToTwitterID(*my_did)), url.QueryEscape(authenticating_user.ScreenName)))
7891
}
7992
// We have an unknown request. huh. Probably registration, i'll find a way to send an error msg for that later, as registration is out of scope.
8093
return c.SendStatus(501)

0 commit comments

Comments
 (0)