C# Xamarin.forms身份验证PKCE
我有一个Identity server 4应用程序,我正在尝试使用PKCE使用我的Xamarin.forms应用程序登录该应用程序。我一直从identity server收到一个错误,这是我以前从未见过的错误C# Xamarin.forms身份验证PKCE,c#,xamarin,oauth,identityserver4,pkce,C#,Xamarin,Oauth,Identityserver4,Pkce,我有一个Identity server 4应用程序,我正在尝试使用PKCE使用我的Xamarin.forms应用程序登录该应用程序。我一直从identity server收到一个错误,这是我以前从未见过的错误code_challenge缺失我猜我使用了错误的赠款类型,但我为Xamarin找到的所有文档都表明我应该使用此类型 如何将Xamarin连接到Identity server 4 错误 Identity server中的客户端id 如果我从identity server中的客户机中删除Req
code_challenge缺失
我猜我使用了错误的赠款类型,但我为Xamarin找到的所有文档都表明我应该使用此类型
如何将Xamarin连接到Identity server 4
错误
Identity server中的客户端id
如果我从identity server中的客户机中删除RequirePkce=true,
,我就不会再收到有问题的错误。据我所知,Xamarin.auth还不支持PKCE。这意味着我要么禁用它,要么自己实现它
如何在启用PKCE的情况下从XAmarin表单登录到Identity server 4 看起来PKCE是在
OAuth2Authenticator
中通过没有客户端密码启用的:
protected bool IsProofKeyCodeForExchange
{
get
{
return
accessTokenUrl != null // AccessToken url is defined
&&
string.IsNullOrWhiteSpace(clientSecret) // Client Secret is not defined
;
}
}
所以我会试试
Authenticator = new OAuth2Authenticator
(
_clientId,
null,
_scopes,
new Uri(_discoveryDoc.AuthorizationEndpoint),
_redirectUri,
new Uri(_discoveryDoc.TokenEndpoint),
null,
isUsingNativeUI: true
);
已尝试,但仍收到相同的错误消息。你的权利看起来应该得到支持
Authenticator = new OAuth2Authenticator
(
_clientId,
_secret,
_scopes,
new Uri(_discoveryDoc.AuthorizationEndpoint),
_redirectUri,
new Uri(_discoveryDoc.TokenEndpoint),
null,
isUsingNativeUI: true
);
protected bool IsProofKeyCodeForExchange
{
get
{
return
accessTokenUrl != null // AccessToken url is defined
&&
string.IsNullOrWhiteSpace(clientSecret) // Client Secret is not defined
;
}
}
Authenticator = new OAuth2Authenticator
(
_clientId,
null,
_scopes,
new Uri(_discoveryDoc.AuthorizationEndpoint),
_redirectUri,
new Uri(_discoveryDoc.TokenEndpoint),
null,
isUsingNativeUI: true
);