OAuth API token fetch fails

I’m following this guide to test the oauth integrations with PHP though the example code from github: https://developer.squareup.com/docs/oauth-api/walkthrough

But I’m getting an error about v1:

I understand that the sandbox is for v2 only, but I’m not specifying any v1 connection.

The authorization is working, but when I try to fetch the token, it fails. I understand, that there is a different endpoint (or package?) I have to use, for the guide to connect to v2 endpoints?

Any help is apreciated.

Hi @axme welcome to the forums!

The errors from OAuth say v1 due to how old OAuth is, but there is not another endpoint to use, this is the correct one. Authorization errors within OAuth basically mean either the client_id (application id) or the client_secret (application secret) that you’re passing in the request are incorrect or do not match. Be sure that if you’re using sandbox, that you’re using your sandbox app id and secret, and not your production ones.