是否有人使用Xamarin.Auth或IdentityModel实现了Xamarin.Auth身份验证?我试过使用IdentityModel和Xamarin.Auth,从外观上看,它们都有缺失的特性。
发布于 2019-03-07 00:01:31
解决了。最后,我使用了Xamarin.Auth与IdentityServer4 (至少目前在iOS中)合作,因为Google (而不是android)不喜欢在IdentityModel中使用WebView。
对于其他可能在OAuth2Authenticator中使用IdentityServer4时遇到类似问题的开发人员,下面是发生了什么以及对我起了什么作用:
- My RedirectUrl didn't have a slash at the end when initialising OAuth2Authenticator
- The extra slash at the end was magically added when I converted NSUrl to Uri inside the OpenUrl method in AppDelegate.cs before calling OneListAppContext.AuthenticationState.Authenticator.OnPageLoading(url).
- I guess it's a standard to have a slash before the question mark in the url query? If it is, I didn't know that because adding ?name=value in the url has always worked.
- NSUrl coming from Safari in the OpenUrl method was myappname://oauth?code=1ec450f88737fcae0a2786699d5df24e3ca97a8b55c09da2ef13d58035821134...
- New Uri after converting NSUrl to Uri was was myappname://oauth/?code=1ec450f88737fcae0a2786699d5df24e3ca97a8b55c09da2ef13d58035821134... (notice there's / after oauth)
修复非常简单: 1.将我的客户端配置的RedirectUrl更改为有/在末尾(例如myappname://oauth/) 2.将RedirectUrl在客户机中初始化为OAuth2Authentic /在末尾(例如myappname://oauth/)
https://stackoverflow.com/questions/55001288
复制相似问题