C# windows应用程序中的Dwolla oauth访问令牌

C# windows应用程序中的Dwolla oauth访问令牌,c#,microsoft-metro,oauth-2.0,dwolla,C#,Microsoft Metro,Oauth 2.0,Dwolla,我正在创建windows 8 metro应用程序,但在获取oauth2访问令牌时遇到问题。我可以用这个代码很好地获得临时代码: Uri requestUri = new Uri(string.Format(AUTH_URL + "?client_id={0}&response_type=code&scope={1}&client_secret={2}&redirect_uri={3}", CLIENT_ID, string.Join("|", scopeList.

我正在创建windows 8 metro应用程序,但在获取oauth2访问令牌时遇到问题。我可以用这个代码很好地获得临时代码:

Uri requestUri = new Uri(string.Format(AUTH_URL + "?client_id={0}&response_type=code&scope={1}&client_secret={2}&redirect_uri={3}", CLIENT_ID, string.Join("|", scopeList.ToArray()), CLIENT_SECRET, WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri));
        WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, requestUri);
但是,当我尝试使用该代码获取永久访问令牌时,它要么给我一个内部服务器错误(500),要么超时。当我没有重定向uri时,它会给我一个500,所以我把它保留在里面。否则,我的请求将超时,并且没有响应,代码如下:

private const string TOKEN_URL = "https://www.dwolla.com/oauth/v2/token";
Uri requestUri = new Uri(string.Format(TOKEN_URL + "?client_id={0}&client_secret={1}&grant_type={2}&code={3}&redirect_uri={4}", CLIENT_ID, CLIENT_SECRET, GRANT_TYPE, code, WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri)));
        WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.SilentMode, requestUri);
我所有的字符串都是uri转义的。我只是不知道我做错了什么

使用WebAuthenticationOptions.SilentMode选项之外的任何选项只会显示一个正在加载的浏览器窗口

另外,我不能使用为C#设计的OAuth库,因为它们使用.NetFramework,而Windows 8应用程序使用.NetCore,一个精简版本


任何帮助都很好

临时代码和重定向永久访问令牌之间的
requestUri
看起来不同。它必须是完全相同的东西