1

Google カレンダー統合用のアプリケーションを開発しました。カレンダー サービスを使用しているときに、ある場所で行き詰まりました。以下のコードを確認してください。

private static IAuthorizationState GetAuthorization(NativeApplicationClient arg, String Refreshtoken)
{                    
    IAuthorizationState state = new AuthorizationState(new[] { CalendarService.Scopes.Calendar.GetStringValue() });
    state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl);
    state.RefreshToken = Refreshtoken;
    try
    {
        if (arg.RefreshToken(state))     // This is calling out to the OAuth servers with the refresh token getting back a session token, returns true if successful.
        {
            if (state.RefreshToken != Refreshtoken) // if the refresh token has changed, save it.
            {
              //save token
            }
            return state; // Retain the authorization state, this is what will authenticate your calls.
        }
    }
    catch (Exception ex)
    {

    }
    return state;
}

私が得ている例外は

Exception:
at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request,         
DirectWebRequestOptions options) at 
DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request) at 
DotNetOpenAuth.Messaging.Channel.GetDirectResponse(HttpWebRequest webRequest) at 
DotNetOpenAuth.Messaging.Channel.RequestCore(IDirectedProtocolMessage request) at     
DotNetOpenAuth.Messaging.Channel.Request(IDirectedProtocolMessage requestMessage) at 
DotNetOpenAuth.Messaging.Channel.Request[TResponse](IDirectedProtocolMessage requestMessage) at 
DotNetOpenAuth.OAuth2.ClientBase.RefreshToken(IAuthorizationState authorization, Nullable`1 
skipIfUsefulLifeExceeds) at GoogleCalendarProvider_V3.GetAuthorization(NativeApplicationClient 
arg, String Refreshtoken)

Exception Message:
Error occurred while sending a direct message or getting the response. 
4

0 に答える 0