0

I can't get authorization URL to coinbase connect OAuth2 api.

fetch("https://www.coinbase.com/oauth/authorize?response_type=code&client_id=cc460ce71913c49e4face4ac0e072c38564fabea867ebcd7ab9905970d8f3021&redirect_uri=http://localhost:3000/callback&state=SECURE_RANDOM&scope=wallet:accounts:read")
      .then(res => res.json())
      .then(
        (result) => {
          console.log(result)
        },
        (error) => {
          console.log(error)
        }
      )

give me this error

enter image description here

Alex
  • 1
  • 1
  • 1
    try this solution? https://stackoverflow.com/questions/41497674/access-control-allow-origin-issue-when-api-call-made-from-react-isomorphic-ap – genericHCU Dec 17 '21 at 16:37

1 Answers1

0

You can disable cors like that :

fetch('https://www.coinbase.com/oauth/authorize?response_type=code&client_id=cc460ce71913c49e4face4ac0e072c38564fabea867ebcd7ab9905970d8f3021&redirect_uri=http://localhost:3000/callback&state=SECURE_RANDOM&scope=wallet:accounts:read', {
mode: 'no-cors',
method:'GET'
}).then(res => res.json())
  .then(
    (result) => {
      console.log(result)
    },
    (error) => {
      console.log(error)
    }
  )
Jonathan Delean
  • 1,011
  • 1
  • 8
  • 25