authorization to gmail

אדם 08

New member
authorization to gmail

אני רוצה להוסיף לאתר שלי authorization לgmail. אני מבין שאפשר לבצע authorization ואח"כ להמיר אתו לauthentication token. נכון? מנסה להגיע בדיוק למסך כמו שמוצג ראשון פה: http://www.limilabs.com/blog/oauth-with-gmail הורדתי dotNetopenAuth נסיתי לכתוב קוד בc# שמבצע authorization אבל אני לא בטוח איפה אני מוסיף איזה לאיזה מוצרים אני מבקש גישה מה גם שחוזרת לי שגיאה מהשרת של גוגל.
public void PrepareAuthorizationRequest(Uri authCallbakUrl) { var consumer = new WebConsumer(GoogleConsumerConsts.ServiceDescription, mConsumerTokenManager); // request access consumer.Channel.Send(consumer.PrepareRequestUserAuthorization(authCallbakUrl, null, null)); throw new NoRedirectToAuthPageException(); } public ProcessAuthorizationRequestResponse ProcessAuthorizationRequest() { ProcessAuthorizationRequestResponse response; // Process result from the service provider var consumer = new WebConsumer(GoogleConsumerConsts.ServiceDescription, mConsumerTokenManager); var accessTokenResponse = consumer.ProcessUserAuthorization(); // If we didn't have an access token response, this wasn't called by the service provider if (accessTokenResponse == null) response = new ProcessAuthorizationRequestResponse { IsAuthorized = false }; else { // Extract the access token string accessToken = accessTokenResponse.AccessToken; response = new ProcessAuthorizationRequestResponse { IsAuthorized = true, Token = accessToken, Secret = mConsumerTokenManager.GetTokenSecret(accessToken) }; } return response; } private string Test2() { // Process result from linked in var google = new WebConsumer(GoogleConsumerConsts.ServiceDescription, mConsumerTokenManager); // var accessToken = GetAccessTokenForUser(); var accessToken = String.Empty; // Retrieve the user's profile information var endpoint = GoogleConsumerConsts.GetGmailFeedsEndpoint;// new MessageReceivingEndpoint("http://api.linkedin.com/v1/people/~", HttpDeliveryMethods.GetRequest); var request = google.PrepareAuthorizedRequest(endpoint, accessToken); var response = request.GetResponse(); return (new StreamReader(response.GetResponseStream())).ReadToEnd(); }​
זה אמור להיות פשוט. בכל זאת לא מצליח. מישהו מכיר?
 
למעלה