I’m following the OAuth2 instructions and I was able to get the first part working which returns an auth_code.
When I try to do the next step (exchange the auth code for an access token) I am consistently getting a 404 html page response. I would have expected a JSON response from this endpoint (even for an error)
Is this the correct url? Is this also the url to use for a playground/sandbox account?
Is it ok that the redirect_uri is a localhost url? It worked for the first part and I’m using the exact same url for the accesstoken POST request (as specified in the documentation)
Is the client_secret supposed to use the OAuth2 Client Secret or the API Key? The documentation shows client_secret=<API_KEY> so it is a little unclear.
I tried it again and received this error message… “Missing required request params.”
I remembered seeing the following post when I was searching for more information about oauth.
In that post there is an image and in that image they show an additional request parameter.
grant_type=authorization_code
So I tried it again and included the “grant_type=authorization_code” parameter and it worked.
That parameter is currently not included in the documentation.
I was able to get this to work for my non-sandbox developer account, but it did not work for my “Playground/Sandbox” account.
Is there a different “accesstoken” endpoint that can be used for “Playground/Sandbox” accounts?
Thank you so much for following up! We will make sure that piece of the documentation gets updated as well.
I just checked with our engineers that also build apps in sandbox and the access token URL should be this: https://api-sandbox.yext.com/oauth2/api/accesstoken. Typically, we don’t recommend building and publishing apps in sandbox, which is why we don’t call that out in the documentation so we will leave that one out, but if you would like to test your changes and updates in sandbox, feel free.