servicestack,linkedin,xamarin.auth,Oauth 2.0,servicestack,Linkedin,Xamarin.auth" /> servicestack,linkedin,xamarin.auth,Oauth 2.0,servicestack,Linkedin,Xamarin.auth" />

Oauth 2.0 Servicestack LinkedIn Oauth2与Webauthenticator不返回应用程序

Oauth 2.0 Servicestack LinkedIn Oauth2与Webauthenticator不返回应用程序,oauth-2.0,servicestack,linkedin,xamarin.auth,Oauth 2.0,servicestack,Linkedin,Xamarin.auth,您好,我在使用Xamarin.auth组件进行Servicestack身份验证时遇到问题 当使用WebAuthencator尝试使用ServiceStack进行身份验证时,我正在获得身份验证,但无法像仅使用Xamarin.Auth那样返回应用程序 [Route("/my-session")] public class CustomUserSession : AuthUserSession ,IReturn<CustomUserSession> { public string

您好,我在使用Xamarin.auth组件进行Servicestack身份验证时遇到问题

当使用WebAuthencator尝试使用ServiceStack进行身份验证时,我正在获得身份验证,但无法像仅使用Xamarin.Auth那样返回应用程序

[Route("/my-session")]
public class CustomUserSession : AuthUserSession ,IReturn<CustomUserSession>
{
    public string GithubProfileUrl { get; set; }
    public string TwitterProfileUrl { get; set; }
    IRedisClientsManager RedisManager;


    public override void OnAuthenticated(IServiceBase authService, IAuthSession session, IOAuthTokens tokens, Dictionary<string, string> authInfo)
    {
        base.OnAuthenticated(authService, session, tokens, authInfo);
        var userAuthRepo = authService.ResolveService<IUserAuthRepository>();
        var userAuth = userAuthRepo.GetUserAuth(session.UserAuthId);
}

}
而在浏览器中对/api/my_info的相同调用将重定向到auth并获取信息

浏览器请求:

GET /api/my_info HTTP/1.1
Host: sample.com
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: ss-pid=pnxqAEU3ExIzrVZ8QdR/; ss-id=qCAkeAUDbQ+QRkZvIQgv; DotNetOpenAuth.WebServerClient.XSRF-Session=lFqnWxGQfdOZEF55MrLT_Q; X-UAId=1
浏览器响应:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html
Server: Microsoft-IIS/8.5
X-Powered-By: ServiceStack Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 22 Nov 2016 20:38:37 GMT
Content-Length: 9443
Connection: keep-alive

<!doctype html>
<html lang="en-us">
<head>
<title>Simple Snapshot of 11/22/2016</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
BODY, H1, H2, H3, H4, H5, H6, DL, DT, DD {
..............
HTTP/1.1200正常
缓存控制:专用
内容类型:text/html
服务器:Microsoft IIS/8.5
X-Powered-By:ServiceStack Win32NT/.NET
X-AspNet-Version:4.0.30319
X-Powered-By:ASP.NET
日期:2016年11月22日星期二20:38:37 GMT
内容长度:9443
连接:保持活力
2016年11月22日的简单快照
阀体,H1,H2,H3,H4,H5,H6,DL,DT,DD{
..............

另外,JsonServiceClient获取ss id,但随后调用authenticate service失败,401。

有一个示例项目,其中的文档显示了如何使用Xamarin对ServiceStack进行身份验证。Auth可从以下网址获得:


我也采用了相同的解决方案,但仍然停留在LinkedIn提供的重定向URI上。我遇到了问题here@TechCruizeNotFound异常表示您试图调用的服务不存在。演示使用它作为在您进行身份验证后调用经过身份验证的服务的示例,对于TechStacks示例,它调用它。@TechCruize Ex实际上,与任何其他服务一样,它仍然只是返回一个填充的DTO。请发布原始HTTP头,这是判断发生了什么的最好方法。@TechCruize如果添加
[Authenticate]
导致错误,则表明您没有经过身份验证的客户端。
[Authenticate]的目的是
属性用于确保只有经过身份验证的用户才能访问该服务-一个错误表示请求未经过身份验证。正如我在上面多次要求的那样,我们需要查看身份验证请求+失败服务请求的原始HTTP请求/响应头,以查看实际发生的情况。
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html
Server: Microsoft-IIS/8.5
X-Powered-By: ServiceStack Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 22 Nov 2016 20:38:37 GMT
Content-Length: 9443
Connection: keep-alive

<!doctype html>
<html lang="en-us">
<head>
<title>Simple Snapshot of 11/22/2016</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
BODY, H1, H2, H3, H4, H5, H6, DL, DT, DD {
..............