Accessing LinkedIn cookie via ASP.NET MVC
I've implemented the new LinkedIn JavaScript API to log in, and I'm trying to access a cookie. I've verified that it can be found in FireBug's Cookie window:
linkedin_oauth_*API_KEY*开发者_如何学C
where API_KEY is my API string.However, when I try to access the cookie in ASP.NET MVC code:
HttpCookie c = HttpContext.Current.Request.Cookies[cookieName];
It can't find any cookie with that name in the Cookies collection.
In FireBug, I see the cookie's properties are Expires=Session and Security=Secure
Is there a way to access cookies with these settings?
Problem is that the same origin policy applies also for the cookies, so your server backend doesn't receive the cookie.
I guess you want to sign-in with LinkedIn Js api, pass the oauth token to the server, and then make normal oauth calls on the server side? For this scenario, you need to send the oauth token back to the server. There is nice article describing this scenario: Exchange JSAPI Tokens for REST API OAuth Tokens
You can only access those cookie through HTTPS
精彩评论