Skip to main content

Integrating with Wix REST API

https://localhost:3000/wix-recommended-products/redirect https://localhost:3000/wix-recommended-products/app

how to oauth documentation: https://devforum.wix.com/en/article/using-oauth-to-access-data-8245084 https://devforum.wix.com/en/article/getting-started-with-apis

API docs: https://dev.wix.com/docs/api/

Message to Wix:​

Hi There,

This is Ben from POWr.io. We're looking into building an App that uses API access. Have been implementing OAuth according to your docs here, but the response we get is not matching what is written: https://devforum.wix.com/en/article/using-oauth-to-access-data-8245084

Specifically, Step 2 says we receive a response like: https://my-app-domain/redirect-url?code={JWT_TOKEN}&state={state}&instanceId={instanceId}

What we are actually receiving is https://my-app-domain/redirect-url?token={TOKEN_STRING}

I.e. we are not receiving a 'code' parameter but instead a 'token' parameter that is not in JWT format.

When in Step 3 we try to make a POST request as follows using that same token, we receive an error:

curl -X POST \ https://www.wix.com/oauth/access \ -H 'Content-Type: application/json' \ -d '{

"grant_type": "authorization_code",
"client_id": APP_ID,
"client_secret": APP_SECRET,
"code": TOKEN_STRING

}'

The error is like: {"errorCode":20002,"errorDescription":"Internal Server Error [request-id: 1549584757.7194857644916121717]","success":false,"payload":null}

Can you help shed light on what is the issue here?

Many thanks!