Search code examples
smartsheet-api

"The client ID is missing or invalid" in OAuth request


I'm trying to set up OAuth2 flow between my application and Smartsheet, using the instructions at http://smartsheet-platform.github.io/api-docs/?shell#oauth-flow.

It seems as if the client_id parameter is being lost when the user submits Smartsheet's authorization dialog. Here's what I'm seeing:

My web page displays a link to https://app.smartsheet.com/b/authorize?response_type=code&client_id=[my_client_id]&scope=READ_SHEETS%20WRITE_SHEETS%20SHARE_SHEETS

(From here on, I will be omitting the protocol and domain from URLs, as I have posted little enough to Stack Overflow that I am unable to include more than two links in a question!)

I click that link, and wind up on /b/authorize?formName=fn_authorize&formAction=fa_loadAuthorize&response_type=code&client_id=[my_client_id]&scope=READ_SHEETS+WRITE_SHEETS+SHARE_SHEETS . The dialog shows the logo and name of my web site, so I know that the client_id is correct.

Then I click "Allow" and see the message "The client ID is missing or invalid" at /b/authorize?formName=fn_authorize&formAction=fa_loadAuthorize&redirect_uri=[my redirect uri]

I've gone over the instructions a couple of times to make sure the URI I'm generating is valid, and have tried it with and without the redirect_uri parameter.

What might I be doing wrong?


Solution

  • I'm unable to reproduce the issue you've described, even using the oAuth URL copied exactly from your post/question. Here's a recap of my test scenario:

    1. Created new "App" (via Developer Tools in the Smartsheet UI) to generate a client id and app secret.

    2. Redirected user to: https://app.smartsheet.com/b/authorize?response_type=code&client_id=[my_client_id]&scope=READ_SHEETS%20WRITE_SHEETS%20SHARE_SHEETS

    3. User clicks Allow.

    4. User is successfully redirected to the redirect URL that's specified in my App config settings.

    So, Smartsheet oAuth appears to be functioning successfully. Which would seem to suggest that perhaps it's something specific to your App config settings that's causing your issue. A couple of suggestions for troubleshooting:

    • Try editing your App config settings to (temporarily) replace the value of App redirect URL with something simple like: http://www.google.com -- then test oAuth flow again. If it works with the new redirect URL, that'd suggest an issue with Smartsheet not being able to redirect to your original redirect URL (and the "client id is missing or invalid" error message is not really an accurate message).

    • If changing the redirect URL doesn't resolve the error -- perhaps try creating a new App altogether (via Developer Tools in the Smartsheet UI), and attempt the same oAuth flow using that new App's client id. If for some reason there's something corrupt about the App that's giving you the error now, then it's possible that starting over with a new App altogether will resolve your issue.