如何在我的ASP.NET MVC 5项目中获取我的linkedin连接的详细信息? [英] How to get details of my linkedin connections in my ASP.NET MVC 5 project?

查看:57
本文介绍了如何在我的ASP.NET MVC 5项目中获取我的linkedin连接的详细信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个mvc项目,我需要获取我的linkedin连接的详细信息(我的朋友在LinkedIn中的详细信息)。



我有什么尝试过:



我使用javascript sdk完成了将linkedin集成到我的项目中。

I am designing an mvc project where I need to get details of my linkedin connections(details of my friends in LinkedIn).

What I have tried:

I completed integration of linkedin into my project using javascript sdk.

推荐答案

我想你想要OAuth for Linked in。检查OAuth的Owin包。只需使用linkedIn注册您的应用程序,您将获得唯一ID,在您的应用程序中注册。



以下是一些可能对您有帮助的代码片段。

I think you want OAuth for Linked in. Check for Owin packages for OAuth. Simply register your application with linkedIn, you'll get unique id, Register it in your app.

Below are few code snippets which might help you.
private void RegisterLinkedInAccount(IAppBuilder app)
		{
			var clientId = ConfigUtils.GetLinkedInClientId;
			var clientSecret = ConfigUtils.GetLinkedInClientSecret;
			LinkedInAuthOptions = new LinkedInAuthenticationOptions()
			{
				ClientId = clientId,
				ClientSecret = clientSecret,
				Provider = new LinkedInAuthProvider()
			};
			LinkedInAuthOptions.Scope.Add("r_emailaddress");
			LinkedInAuthOptions.Scope.Add("w_share");
			LinkedInAuthOptions.Scope.Add("r_basicprofile");
			LinkedInAuthOptions.Scope.Add("rw_company_admin");
			app.UseLinkedInAuthentication(LinkedInAuthOptions);
		}





ConfigUtils包含ClientId和ClientSecret,我们将应用程序注册到linkedIn后会得到。 OAuthConfigureManager包含对上述方法的调用。



为你的项目注册启动并调用上面的方法。



ConfigUtils contains ClientId and ClientSecret which we'll get after registering our app to linkedIn. OAuthConfigureManager contains call to above method.

Register startup for ur project and give call to above method.

public class Startup
	{
		public void Configuration(IAppBuilder app)
		{
			OAuthConfigureManager oauthConfigure = new OAuthConfigureManager();
			oauthConfigure.Configure(app);
		}
	}


这篇关于如何在我的ASP.NET MVC 5项目中获取我的linkedin连接的详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆