MCPcopy Index your code
hub / github.com/Preloading/TwitterAPIBridge / VerifyCredentials

Function VerifyCredentials

twitterv1/auth.go:118–133  ·  view source on GitHub ↗
(c *fiber.Ctx)

Source from the content-addressed store, hash-verified

116}
117
118func VerifyCredentials(c *fiber.Ctx) error {
119 my_did, pds, _, oauthToken, err := GetAuthFromReq(c)
120
121 if err != nil {
122 return MissingAuth(c, err)
123 }
124
125 userinfo, err := blueskyapi.GetUserInfo(*pds, *oauthToken, *my_did, false)
126
127 if err != nil {
128 fmt.Println("Error:", err)
129 return c.Status(fiber.StatusInternalServerError).SendString("Failed to fetch user info")
130 }
131
132 return EncodeAndSend(c, userinfo)
133}
134
135// GetAuthFromReq is a helper function to get the user DID and access token from the request.
136// Also does some maintenance tasks like refreshing the access token if it has expired.

Callers

nothing calls this directly

Calls 3

GetAuthFromReqFunction · 0.85
MissingAuthFunction · 0.85
EncodeAndSendFunction · 0.85

Tested by

no test coverage detected