OAuth Authorization issue. Invalid Query Parameters - ?error=server_error&

Hi @nayelyz @erickv.

I faced the following error while trying to get the authorization token.

The flow is the following:

  1. I’ve created an endpoint, which accepts GET/POST requests - https://our-backend-redirect-url/.
    On POST It parses request.data and returns:
{
  "pingData": {
  "challenge": xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  }
}

  1. Also, i successfully created app via https://api.smartthings.com/v1/apps/ with such payload:
{
  "appName": "AppName",
  "displayName": "displayName",
  "description": "ST Integration",
  "appType": "WEBHOOK_SMART_APP",
  "classifications": [
    "DEVICE"
  ],
  "webhookSmartApp": {
    "targetUrl": "https://our-backend-redirect-url/"
  },
  "oauth": {
    "clientName": "clientNameOAuth",
    "scope": [
        "l:devices"
    ],
    "redirectUris": [
      "https://our-backend-redirect-url/"
    ]
  }
}

  1. After app creation i got app info. There i found client_id(something like: 123456-xxxx-xxxx-xxxx-xxxxxxxxxxxx). .

  2. And after that i’ve tried to get the authorization code by making request to this resourse:
    https://api.smartthings.com/v1/oauth/authorize?client_id=123456-xxxx-xxxx-xxxx-xxxxxxxxxxxx&redirect_uri=https://our-backend-redirect-url/&response_type=code, i got redirected to the Samsung’s login page.

  3. Logged-in and then the following page appeared:

  4. I’ve pressed Authorize and on this moment i should’ve gotten the authorization code in the query parameters, but got this instead:
    https://our-backend-redirect-url/?error=server_error&error_description=Unexpected+server+error.

So what am i doing wrong? PLease help me. Thank you in advance.

Hi, @nabor

Welcome to the SmartThings Community!
Could you provide more details about what you’re trying to do, please?

I see you created a SmartApp through the API, why didn’t you use the Developer Workspace?
What would be its purpose? For example, is it a SmartApp for personal use only?

You can send me a DM if you want more privacy, I just want to know the context to provide better guidance.