Search code examples
asp.netasp.net-mvc-4sessionlinkedin-api

LinkedIn Api Callback expires session


I have TYPE in session e.g. Session["TYPE"].
I access LinkedIn Api to get a LinkedIn user profile but after authentication in LinkedIn Api when Redirect URL is called back my session is expired, which means now Session["TYPE"] is null.

Same process is working perfectly on my development server, there is no session expire issue, but when I deploy it on live server this issue arises.

Why is the session state expired or cleared after the user is being redirected from LinkedIn?


Solution

  • Are your getting redirected to the same domain name?

    The session state uses cookies to persist a unique identifier in the web browser. After accepting the access in LinkedIn, you are redirected to your app. As you may know, cookies apply to only one domain. If the domain name is different, then the session cookie is not there and your session variable is not loaded.