Skip to content

Commit

Permalink
chore(platforms): using new coinbase oauth endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianHymer committed Jan 24, 2025
1 parent 14c20b9 commit d56412f
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 174 deletions.
22 changes: 15 additions & 7 deletions platforms/src/Coinbase/App-Bindings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,27 @@ export class CoinbasePlatform extends Platform {
</Hyperlink>
<br />
<br />
Obtain the Coinbase Stamp by completing the following 2 steps to prove your Coinbase Verified ID and Coinbase account:
Obtain the Coinbase Stamp by completing the following 2 steps to prove your Coinbase Verified ID and Coinbase
account:
<br />
<br />
<strong>Step 1:</strong> <Hyperlink href="https://www.coinbase.com/onchain-verify">Verify your Coinbase ID</Hyperlink> with the same address that you&apos;re currently using with this Passport.
<strong>Step 1:</strong>{" "}
<Hyperlink href="https://www.coinbase.com/onchain-verify">Verify your Coinbase ID</Hyperlink> with the same
address that you&apos;re currently using with this Passport.
<br />
<br />
<strong>Step 2:</strong> Click &quot;Verify&quot; below to sign into your Coinbase account.
<br />
<br />
Important considerations:
<ul>
<li>You <em>must</em> complete both steps to verify this Stamp.</li>
<li>You <em>must</em> have an active Coinbase account with a verified government ID to mint your onchain attestation for free on Base.</li>
<li>
You <em>must</em> complete both steps to verify this Stamp.
</li>
<li>
You <em>must</em> have an active Coinbase account with a verified government ID to mint your onchain
attestation for free on Base.
</li>
</ul>
</div>
),
Expand Down Expand Up @@ -68,9 +76,9 @@ export class CoinbasePlatform extends Platform {
}

async getOAuthUrl(state: string): Promise<string> {
const coinbasebUrl = await Promise.resolve(
`https://www.coinbase.com/oauth/authorize?response_type=code&client_id=${this.clientId}&redirect_uri=${this.redirectUri}&state=${state}`
const coinbaseUrl = await Promise.resolve(
`https://login.coinbase.com/oauth2/auth?response_type=code&client_id=${this.clientId}&redirect_uri=${this.redirectUri}&state=${state}`
);
return coinbasebUrl;
return coinbaseUrl;
}
}
2 changes: 1 addition & 1 deletion platforms/src/Coinbase/Providers/coinbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const requestAccessToken = async (code: string): Promise<string | undefin
params.append("redirect_uri", callback);

// Exchange the code for an access token
tokenRequest = await axios.post("https://api.coinbase.com/oauth/token", params.toString(), {
tokenRequest = await axios.post("https://login.coinbase.com/oauth2/token", params.toString(), {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Accept: "application/json",
Expand Down
10 changes: 5 additions & 5 deletions platforms/src/Coinbase/__tests__/coinbase.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe("Attempt verification", function () {
);
expect(mockedAxios.post).toBeCalledTimes(1);
expect(mockedAxios.post).toBeCalledWith(
"https://api.coinbase.com/oauth/token",
"https://login.coinbase.com/oauth2/token",
`grant_type=authorization_code&client_id=${clientId}&client_secret=${clientSecret}&code=${code}&redirect_uri=${callback}`,
{ headers: { "Content-Type": "application/x-www-form-urlencoded", Accept: "application/json" } }
);
Expand Down Expand Up @@ -190,7 +190,7 @@ describe("Attempt verification", function () {
expect(mockedAxios.post).toBeCalledTimes(1);
// Check the request to get the token
expect(mockedAxios.post).toBeCalledWith(
"https://api.coinbase.com/oauth/token",
"https://login.coinbase.com/oauth2/token",
`grant_type=authorization_code&client_id=${clientId}&client_secret=${clientSecret}&code=${code}&redirect_uri=${callback}`,
{ headers: { "Content-Type": "application/x-www-form-urlencoded", Accept: "application/json" } }
);
Expand Down Expand Up @@ -229,7 +229,7 @@ describe("Attempt verification", function () {

// Check the request to get the token
expect(mockedAxios.post).toBeCalledWith(
"https://api.coinbase.com/oauth/token",
"https://login.coinbase.com/oauth2/token",
`grant_type=authorization_code&client_id=${clientId}&client_secret=${clientSecret}&code=${code}&redirect_uri=${callback}`,
{ headers: { "Content-Type": "application/x-www-form-urlencoded", Accept: "application/json" } }
);
Expand Down Expand Up @@ -260,7 +260,7 @@ describe("Attempt verification", function () {

// Check the request to get the token
expect(mockedAxios.post).toBeCalledWith(
"https://api.coinbase.com/oauth/token",
"https://login.coinbase.com/oauth2/token",
`grant_type=authorization_code&client_id=${clientId}&client_secret=${clientSecret}&code=${code}&redirect_uri=${callback}`,
{ headers: { "Content-Type": "application/x-www-form-urlencoded", Accept: "application/json" } }
);
Expand Down Expand Up @@ -289,7 +289,7 @@ describe("Attempt verification", function () {
expect(mockedAxios.post).toBeCalledTimes(1);
// Check the request to get the token
expect(mockedAxios.post).toBeCalledWith(
"https://api.coinbase.com/oauth/token",
"https://login.coinbase.com/oauth2/token",
`grant_type=authorization_code&client_id=${clientId}&client_secret=${clientSecret}&code=${code}&redirect_uri=${callback}`,
{ headers: { "Content-Type": "application/x-www-form-urlencoded", Accept: "application/json" } }
);
Expand Down
Loading

0 comments on commit d56412f

Please sign in to comment.