How to obtain access to WorkSheet Home without following 3-leg OAuth process
Hi.
We are using SmartSheet to store multiple sheets that should be created by one person. This person will share one or more sheets in each of multiple workspaces.
I am writing an application (in C#, hosted on AWS Lambda) that must access each Workspace, and Sheet, and read each Sheet. I am using the official SmartSheet C# SDK.
The application code seems to work when I execute it manually. It can access my Sheets in multiple Workspaces, and I only have a Trial/Free account.
When I attempt to execute the code to access another Workspace/Home, it times-out in the DefaultHttpClient.CreateRestRequest() method call where I am tring to perform a HomeResources.GetHome() request.
Do I need to authorise my application to perform this? (As described here:http://smartsheet-platform.github.io/api-docs/?csharp#oauth-flow)
If so, how? My code is not hosted on a web server - it's not on a web page, so I don't know how it could be authorised by the aforementioned process.
Do I need to do something like described in the following links:
https://deanhume.com/a-simple-guide-to-using-oauth-with-c/
https://stackoverflow.com/questions/4002847/oauth-with-verification-in-net
https://forge.autodesk.com/blog/expanding-net-desktop-apps-cloud-running-sample
Comments
-
Ok, so I worked it out.
首先,the OAuth process is necessary only if you want to access SmartSheet with a specific user's credentials.
And regarding the OAuth 3 leg authorisation, I followed the example located at the following URL...
... and I was able to get a token.
For my use-case, I worked out that I didn't need the OAuth token.
NOTE:The OAuth token is only valid for 7 days. You are required to refresh the token periodically.
-
Did you ever get this working? As for the Smartsheet side of things it sounds like you won't need to use the OAuth flow to get your requests made. Instead you can generate an access token from within the account that has the correct access to everything and then set that as an environment variable or put it in a config file of some kind to access it. Then you can set the access token when constructing your Smartsheet client. More info on Access Tokens is in thedocs.
-
Yes, I got it working. As I mentioned in my first (2nd?) post, OAuth is not required for this, and having the Accesstoken works fine.
Using the links I posted I was able to build an OAuth "hack" that allowed me to get access __IF__ I wanted to do things that way. Any OAuth authenticated access is valid for 7 days though. And for me, that would be a challenge.
Categories
=IFERROR(INDEX(DISTINCT(LOWER(<\/strong>COLLECT(.....................))<\/strong>), 1), \"//www.santa-greenland.com/community/discussion/54001/\")<\/p> I haven't tested it yet, but I feel like it should work.<\/p>"},{"commentID":386435,"body":" Right. There are already a number of posts here in the community detailing how to pull a distinct or unique list from another sheet via formula. It usually involves the formula above without the LOWER function. The number 1 would output the first distinct value. Changing that to a 2 will output the second distinct value, so on and so forth. I usually use a helper column with the numbers manually entered so I can apply it as a column formula.<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":320,"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":369,"urlcode":"bridge-by-smartsheet","name":"Bridge"}]},{"discussionID":107674,"type":"question","name":"API PUT and Body help for Cell link from a cell in sheet \"a\" to sheet \"b\"","excerpt":"I am having trouble linking a cell from sheet a to b. I am new to using API and possibly just getting the call wrong? or the body. Any help would be appreciated. PUT: https:\/\/api.smartsheet.com\/2.0\/sheets\/4098048888098692\/rows\/1370574824361860\/cells\/259016080 Body: { \"cells\": [ { \"linkinFromCell\": {…","snippet":"I am having trouble linking a cell from sheet a to b. I am new to using API and possibly just getting the call wrong? or the body. Any help would be appreciated. PUT:…","categoryID":320,"dateInserted":"2023-07-17T16:23:24+00:00","dateUpdated":"2023-07-18T10:24:44+00:00","dateLastComment":"2023-07-18T16:45:05+00:00","insertUserID":135530,"insertUser":{"userID":135530,"name":"Carlo Rodriguez","url":"https:\/\/community.smartsheet.com\/profile\/Carlo%20Rodriguez","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-21T15:50:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":91566,"lastUserID":135530,"lastUser":{"userID":135530,"name":"Carlo Rodriguez","url":"https:\/\/community.smartsheet.com\/profile\/Carlo%20Rodriguez","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-21T15:50:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":60,"score":null,"hot":3379310909,"url":"https:\/\/community.smartsheet.com\/discussion\/107674\/api-put-and-body-help-for-cell-link-from-a-cell-in-sheet-a-to-sheet-b","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/107674\/api-put-and-body-help-for-cell-link-from-a-cell-in-sheet-a-to-sheet-b","format":"Rich","tagIDs":[472,563],"lastPost":{"discussionID":107674,"commentID":385785,"name":"Re: API PUT and Body help for Cell link from a cell in sheet \"a\" to sheet \"b\"","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/385785#Comment_385785","dateInserted":"2023-07-18T16:45:05+00:00","insertUserID":135530,"insertUser":{"userID":135530,"name":"Carlo Rodriguez","url":"https:\/\/community.smartsheet.com\/profile\/Carlo%20Rodriguez","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-21T15:50:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-07-18T16:45:08+00:00","dateAnswered":"2023-07-18T11:38:00+00:00","acceptedAnswers":[{"commentID":385713,"body":"
<\/p>