【发布时间】:2017-04-08 20:25:11
【问题描述】:
我找不到向我的 Xamarin.Auth 请求添加随机数以连接到我的 okta 登录名的方法。我是 xamarin 和 nugets 包的新手,我不知道如何修改 1.3.0 版的 OAuth2Authenticator 的实现。
我正在尝试将请求参数用作:
auth.RequestParameters.Add("nonce", Guid.NewGuid().ToString("N"));
但我一直在 okta 的 nonce 无效错误中运行。
如果你们中有人知道如何解决它。
完整的请求来了:
//start login flow seting our openId flow
public void StartFlow(string responseType, string scope)
{
//webViewLogin.Hidden = false;
var auth = new OAuth2Authenticator(
clientId: OAuthClientId,
scope: scope,
authorizeUrl: new Uri(oktaTenantUrl),
redirectUrl: new Uri(OAuthRedirectUrl)
);
auth.RequestParameters.Add("nonce", Guid.NewGuid().ToString("N"));
auth.Completed += (sender, eventArgs) =>
{
DismissViewController(true, null);
if (eventArgs.IsAuthenticated)
{
// Use eventArgs.Account to do wonderful things
}
};
PresentViewController(auth.GetUI(), true, null);
}
【问题讨论】:
-
你得到什么错误?
-
我从服务器收到此错误 > The+authentication+request+has+an+invalid+nonce+parameter.
标签: c# xamarin xamarin.ios