当前位置: 动力学知识库 > 问答 > 编程问答 >

c# 4.0 - Google Plus authentication with Oauth2.0(C#) in console application for insert moment

问题描述:

Google Plus authentication with Oauth2.0(C#) in console application for insert moment.

I have created console application for insert moment. but I struck with authentication(Oauth2.0) process.I am following this post "https://developers.google.com/+/api/latest/moments/insert" for insert Moment. Please help me.

IAuthorizationState state = new AuthorizationState(new[] { TasksService.Scopes.Tasks.GetStringValue() });

var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description);

FullClientCredentials credentials = new FullClientCredentials();

credentials.ApiKey = "<redacted>";

credentials.ClientId = "<redacted>";

credentials.ClientSecret = "<redacted>";

provider.ClientIdentifier = credentials.ClientId;

provider.ClientSecret = credentials.ClientSecret;

var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, GetAuthorization);

List<string> scopes = new List<string>();

scopes.Add("https://www.googleapis.com/auth/plus.me");

scopes.Add("https://www.googleapis.com/auth/userinfo.email");

var state = new AuthorizationState(scopes);

state.Callback = new Uri("http://localhost:15709");

分享给朋友:
您可能感兴趣的文章:
随机阅读: