Skip to content

Commit

Permalink
fix: fix twitter credential
Browse files Browse the repository at this point in the history
fix #596
  • Loading branch information
vplasencia committed Oct 31, 2024
1 parent 3e032d0 commit b4f23dd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion apps/dashboard/.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ VITE_CLIENT_URL=http://localhost:3002
VITE_CLIENT_INVITES_URL=http://localhost:3002?inviteCode=\
VITE_ETHEREUM_NETWORK=sepolia
VITE_GITHUB_CLIENT_ID=a83a8b014ef38270fb22
VITE_TWITTER_CLIENT_ID=NV82Mm85NWlSZ1llZkpLMl9vN3A6MTpjaQ
VITE_TWITTER_CLIENT_ID=SUw4TUFiZGJaSXh2ak1YRkx3TFQ6MTpjaQ
VITE_TWITTER_REDIRECT_URI=http://localhost:3001/credentials
2 changes: 1 addition & 1 deletion apps/dashboard/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ VITE_CLIENT_URL=https://client.bandada.pse.dev
VITE_CLIENT_INVITES_URL=https://client.bandada.pse.dev?inviteCode=\
VITE_ETHEREUM_NETWORK=sepolia
VITE_GITHUB_CLIENT_ID=6ccd7b93e84260e353f9
VITE_TWITTER_CLIENT_ID=NV82Mm85NWlSZ1llZkpLMl9vN3A6MTpjaQ
VITE_TWITTER_CLIENT_ID=SUw4TUFiZGJaSXh2ak1YRkx3TFQ6MTpjaQ
VITE_TWITTER_REDIRECT_URI=https://app.bandada.pse.dev/credentials
2 changes: 1 addition & 1 deletion apps/dashboard/.env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ VITE_CLIENT_URL=https://client-staging.bandada.pse.dev
VITE_CLIENT_INVITES_URL=https://client-staging.bandada.pse.dev?inviteCode=\
VITE_ETHEREUM_NETWORK=sepolia
VITE_GITHUB_CLIENT_ID=6ccd7b93e84260e353f9
VITE_TWITTER_CLIENT_ID=NV82Mm85NWlSZ1llZkpLMl9vN3A6MTpjaQ
VITE_TWITTER_CLIENT_ID=SUw4TUFiZGJaSXh2ak1YRkx3TFQ6MTpjaQ
VITE_TWITTER_REDIRECT_URI=https://app-staging.bandada.pse.dev/credentials
31 changes: 14 additions & 17 deletions libs/credentials/src/providers/twitter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,20 @@ const provider: Web2Provider = {
state: string,
redirectUri: string
): Promise<string> {
const { data } = await request(
"https://api.twitter.com/2/oauth2/token",
{
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: `Basic ${Buffer.from(
`${clientId}:${clientSecret}`
).toString("base64")}`
},
method: "POST",
data:
`redirect_uri=${redirectUri}&` +
`grant_type=authorization_code&` +
`code_verifier=${state}&` +
`code=${code}`
}
)
const data = await request("https://api.twitter.com/2/oauth2/token", {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: `Basic ${Buffer.from(
`${clientId}:${clientSecret}`
).toString("base64")}`
},
method: "POST",
data:
`redirect_uri=${redirectUri}&` +
`grant_type=authorization_code&` +
`code_verifier=${state}&` +
`code=${code}`
})

return data.access_token
},
Expand Down

0 comments on commit b4f23dd

Please sign in to comment.