0
OAuth2を使用するUWPアプリケーションを作成しています。私はWebAuthenticationBrokerクラスを使用しています。デバイス上のデバッグ時には問題ありませんが、リリースと実行に変更するだけで、認証ダイアログを開くときにアプリケーションがクラッシュします。 ここにコードがあります。ほとんどの定型文はMSDNで提供しています。リリースモードでUWP - WebAuthenticationBrokerがデバイス上でクラッシュする
try {
var webAuthenticationResult = await Windows.Security.Authentication.Web.WebAuthenticationBroker.AuthenticateAsync(Windows.Security.Authentication.Web.WebAuthenticationOptions.None, startURI);
switch (webAuthenticationResult.ResponseStatus) {
case Windows.Security.Authentication.Web.WebAuthenticationStatus.Success:
// Successful authentication.
var uri = new Uri(webAuthenticationResult.ResponseData);
var index = uri.Query.IndexOf('=') + 1;
code = uri.Query.Substring(index);
_accessToken = await GetAccessToken(code);
vault.Add(new PasswordCredential("myApp", "token", Token));
break;
case Windows.Security.Authentication.Web.WebAuthenticationStatus.ErrorHttp:
// HTTP error.
throw new HttpRequestException(webAuthenticationResult.ResponseErrorDetail.ToString());
default:
// Other error.
throw new Exception(webAuthenticationResult.ResponseData.ToString());
}
} catch (Exception ex) {
// Authentication failed. Handle parameter, SSL/TLS, and Network Unavailable errors here.
throw ex;
}
* App.Entering/LeavingBackground *に何かがありますか? – Romasz
@Romasz私はいないと、それはほとんどのグーグルが私を送ったところです。 end URIに3番目のパラメータを渡す必要があることが判明しました。なぜそれがデバッグでは大丈夫だったのか分かりませんが...今はすべて良いようです。私の電話の上の余白を取り除く必要があるだけです。私は一つのことをしました、プロジェクトのプロパティで、私はすべてのデータを削除するためのオプションを選択しました。それが何かをしたかどうかわからない。 –