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.