App Token Auth Issue
nguyenHGP opened this issue · comments
- [ X] I have checked that the [SDK documentation][sdk-docs] doesn't solve my issue.
- [ X] I have checked that the [API documentation][api-docs] doesn't solve my issue.
- [ X] I have searched the [Box Developer Forums][dev-forums] and my issue isn't already reported (or if it has been reported, I have attached a link to it, for reference).
- I have searched [Issues in this repo][github-repo] and my issue isn't already reported.
Description of the Issue
When using UploadAsync(), I cannot upload a file using the Primary Access Token. I can however pass a developer token and am able to upload the file.
Steps to Reproduce
-
Create Box Application
string accessToken = "ACCESSTOKEN"; string ClientID = "CLIENT ID"; string FolderID= "FOLDERID"; var auth = new OAuthSession(accessToken, "NOT_NEEDED", 3600, "bearer"); var config = new BoxConfig(ClientID, "", new Uri("http://boxsdk")); var client = new BoxClient(config, auth); try { string fileName = "README.txt"; using (MemoryStream ms = new MemoryStream(System.Text.Encoding.ASCII.GetBytes("this is a test"))) { var fileRequest = new BoxFileRequest { Name = fileName, Parent = new BoxRequestEntity() { Id = FolderID } }; //var bFile = await client.FilesManager.UploadAsync(fileRequest, ms, null, new TimeSpan(0, 0, 30)); try { var bFile = await client.FilesManager.UploadUsingSessionAsync(ms, fileName, PARENTFOLDERID, new TimeSpan(0,0,30),null); var t = bFile; } catch (Exception ex) { string Error = ex.Message; return; } } } catch (Exception exp) { // The new token does not have access to the file any more. }
Expected Behavior
upload file
Error Message, Including Stack Trace
No error. Task just stalls.
This issue has been automatically marked as stale because it has not been updated in the last 30 days. It will be closed if no further activity occurs within the next 7 days. Feel free to reach out or mention Box SDK team member for further help and resources if they are needed.
This issue has been automatically closed due to maximum period of being stale. Thank you for your contribution to Box .NET SDK and feel free to open another PR/issue at any time.