Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I want to get access token using OAuth2Response response = await DropboxOAuth2Helper.ProcessCodeFlowAsync(code, AppKey, AppSecret, uriBuilder.Uri.AbsoluteUri); in C#.Net (not MVC).
Created a method:
public async Task ProcessDropboxCallback(string code) { var AppKey = ""; var AppSecret = ""; var uriBuilder = new UriBuilder(Request.Url); uriBuilder.Query = Request.QueryString.ToString(); uriBuilder.Fragment = null; uriBuilder.Query = null; OAuth2Response response = await DropboxOAuth2Helper.ProcessCodeFlowAsync(code, AppKey, AppSecret, uriBuilder.Uri.AbsoluteUri); string DropboxToken = response.AccessToken; Session["DropboxAccessToken"] = DropboxToken; }
and calling above method in page_load as:
ProcessDropboxCallback(code);
What is happening here is when the compiler reaches to await method, the loop breaks.
It doesn't goes to string Dropbox, so not able to set the token in session. Also it doesn't continues to page_load, loop breaks and the page loads without continuing code after ProcessDropboxCallback(code).
Stuck in this, need help.
Thanks.
It sounds like the issue is that this is an async method, but you're not waiting for the result. I.e., you probably want to await your method call like this:
await ProcessDropboxCallback(code);
It sounds like the issue is that this is an async method, but you're not waiting for the result. I.e., you probably want to await your method call like this:
await ProcessDropboxCallback(code);
Yes, that's true.
But for that I need to make Page_load method "async". Is that a good thing ? Because I am not aware with what will happen if I add async to Page_Load.
No problem. I tried that and now it is working good.
Thank you so much for help.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!