Пример #1
0
        public override object RequestAction(string action, IDictionary <string, string> query)
        {
            if (action == "startOAuth")
            {
                var request = _traktProxy.GetOAuthRequest(query["callbackUrl"]);

                return(new
                {
                    OauthUrl = request.Url.ToString()
                });
            }
            else if (action == "getOAuthToken")
            {
                return(new
                {
                    accessToken = query["access_token"],
                    expires = DateTime.UtcNow.AddSeconds(int.Parse(query["expires_in"])),
                    refreshToken = query["refresh_token"],
                    authUser = _traktProxy.GetUserName(query["access_token"])
                });
            }

            return(new { });
        }
Пример #2
0
 public HttpRequest GetOAuthRequest(string callbackUrl)
 {
     return(_proxy.GetOAuthRequest(callbackUrl));
 }