Inheritance: Hyves.Service.Core.HyvesSession
 private HyvesServerSession LoadHyvesSession(AuthArgs authArgs)
 {
   var hyvesSessionState = (HyvesSessionState)authArgs.InternalData["hyvesSessionState"];
   var hyvesServerSession = new HyvesServerSession(authArgs.Application.ApplicationKey, authArgs.Application.ApplicationSecret, new List<HyvesMethod>());
   hyvesServerSession.LoadState(hyvesSessionState);
   return hyvesServerSession;
 }
        private void SaveHyvesSession(AuthArgs authArgs, HyvesServerSession hyvesServerSession)
        {
            var hyvesSessionState = hyvesServerSession.SaveState();

            authArgs.InternalData["hyvesSessionState"] = hyvesSessionState;
            new AuthManager().UpdateAuthArgs(authArgs);
        }
        private HyvesServerSession LoadHyvesSession(AuthArgs authArgs)
        {
            var hyvesSessionState  = (HyvesSessionState)authArgs.InternalData["hyvesSessionState"];
            var hyvesServerSession = new HyvesServerSession(authArgs.Application.ApplicationKey, authArgs.Application.ApplicationSecret, new List <HyvesMethod>());

            hyvesServerSession.LoadState(hyvesSessionState);
            return(hyvesServerSession);
        }
    public void AuthGetCode(AuthArgs args)
    {
      var hyvesMethods = new List<HyvesMethod>
      {
        HyvesMethod.All
      };
      var hyvesSession = new HyvesServerSession(args.Application.ApplicationKey, args.Application.ApplicationSecret, hyvesMethods);

      var hyvesRequest = new HyvesRequest(hyvesSession);
      string tokenSecret;
      var requestToken = hyvesRequest.CreateRequestToken(out tokenSecret, HyvesExpirationType.Infinite);

      args.InternalData["requestToken"] = requestToken;
      args.InternalData["requestTokenSecret"] = tokenSecret;

      this.SaveHyvesSession(args, hyvesSession);

      var request = HttpContext.Current.Request;
      var oauthCallback = string.Format("{0}://{1}{2}?type=access&state={3}", request.Url.Scheme, request.Url.Host, Paths.SocialLoginHandlerPath, args.StateKey);

      var hyvesAuthUrl = string.Format("http://www.hyves.nl/api/authorize/?oauth_token={0}&oauth_callback={1}", requestToken, HttpUtility.UrlEncode(oauthCallback));
      HttpContext.Current.Response.Redirect(hyvesAuthUrl);
    }
        public void AuthGetCode(AuthArgs args)
        {
            var hyvesMethods = new List <HyvesMethod>
            {
                HyvesMethod.All
            };
            var hyvesSession = new HyvesServerSession(args.Application.ApplicationKey, args.Application.ApplicationSecret, hyvesMethods);

            var    hyvesRequest = new HyvesRequest(hyvesSession);
            string tokenSecret;
            var    requestToken = hyvesRequest.CreateRequestToken(out tokenSecret, HyvesExpirationType.Infinite);

            args.InternalData["requestToken"]       = requestToken;
            args.InternalData["requestTokenSecret"] = tokenSecret;

            this.SaveHyvesSession(args, hyvesSession);

            var request       = HttpContext.Current.Request;
            var oauthCallback = string.Format("{0}://{1}{2}?type=access&state={3}", request.Url.Scheme, request.Url.Host, Paths.SocialLoginHandlerPath, args.StateKey);

            var hyvesAuthUrl = string.Format("http://www.hyves.nl/api/authorize/?oauth_token={0}&oauth_callback={1}", requestToken, HttpUtility.UrlEncode(oauthCallback));

            HttpContext.Current.Response.Redirect(hyvesAuthUrl);
        }
 private void SaveHyvesSession(AuthArgs authArgs, HyvesServerSession hyvesServerSession)
 {
   var hyvesSessionState = hyvesServerSession.SaveState();
   authArgs.InternalData["hyvesSessionState"] = hyvesSessionState;
   new AuthManager().UpdateAuthArgs(authArgs);
 }