Web を開いて、ユーザーが自分のアプリにファイルへのアクセスを許可できるようにしたいと考えています。コードは次のとおりです。
config = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.DropBox) as DropBoxConfiguration;
requestToken = DropBoxStorageProviderTools.GetDropBoxRequestToken(config, "XXXXXXXX", "YYYYYYYYY");
AuthorizationUrl = DropBoxStorageProviderTools.GetDropBoxAuthorizationUrl(config, requestToken);
Uri requestUri = new Uri(AuthorizationUrl);
Debug.WriteLine("Done requestUri");
Uri callbackUri = WebAuthenticationBroker.GetCurrentApplicationCallbackUri();
Debug.WriteLine("Done callbackUri");
WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, requestUri, callbackUri);
if (result.ResponseStatus == WebAuthenticationStatus.Success)
{
ICloudStorageAccessToken accessToken = DropBoxStorageProviderTools.ExchangeDropBoxRequestTokenIntoAccessToken(config, "7nu03leznnz6x74", "ex3gge8av7kp9lq", requestToken);
}
constructor() の前にこれらのインスタンスを宣言すると、次のようになります。
static DropBoxRequestToken requestToken;
static DropBoxConfiguration config;
String AuthorizationUrl;
A first chance exception of type 'System.UriFormatException' occurred in System.ni.dll
実行すると、行に例外がありますUri callbackUri = WebAuthenticationBroker.GetCurrentApplicationCallbackUri();
。
そして、次Uri callbackUri
のような文字列に変更すると
Uri callbackUri = new Uri("https://google.com");
それは問題なく動作しますDebug.WriteLine("Done callbackUri");
が、新しい例外が発生します:
An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
行で:
WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, requestUri, callbackUri);
それで、私は何を間違えましたか?Web認証を開いた後、アプリへのコールバック呼び出しを行いたいだけです。
ありがとうございました。