smartsheet-apismartsheet-c#-sdk-v2smartsheet-java-sdk-v2

Accessing Smartsheet Oauth in html page


I have asked in my post earlier what url / redirect url I should use here: how to request auth code from Smartsheet via Postman An user suggested me to ngrok, it gave me a temporary website when I set the http to 80. However, I noticed the forwarding website given is different every time I type

./ngrok http 80

Here are my questions:

  1. if the forwarding website is different , how am I able to get a 'allow access' page as I don't know what app url and redirect url I should put for my Smartsheet.

  2. I tried to request the website by typing ./ngrok http80 It gave me a forwarding , so I type the website as my app url, and /callback as the redirect url, I still don't get the 'allow access' page the Smartsheet documentation asks me to type in the following

    https://app.smartsheet.com/b/authorize?response_type=code&client_id=dheu3dmkd32fhxme&scope=READ_SHEETS%20WRITE_SHEETS&state=MY_STATE

    I tried to use postman for the command above, it does not show me any error nor showing the 'allow access' page. I am trying to get the 'allow access' page to work in my html file, but I am not sure what code I should put.

I am novice to smarsheet API, any explanation in detail will be appreciated. thank you in advance.


Solution

  • Looking at the ngrok docs you can set a custom subdomain each time you launch ngrok. This way you can have the same URL for repeated use. This way you could have a command to run ngrok look like this:
    ngrok http -subdomain=testsmartsheetoauth 80
    Your URL would look like this:
    http://testsmartsheetoauth.ngrok.io
    And your callback could be set to this:
    http://testsmartsheetoauth.ngrok.io/callback
    This should give you the persistent URLs you need that your app could use for the OAuth flow.