예제 #1
0
        public string PrepareAuthRequest(PrepareAuthenticationContext context)
        {
            var callback = new Uri(Utils.GetUrlBase(context.RequestUri) + context.RedirectPath);

            var consumer = new TwitterConsumer(context.SessionStorage);
            return consumer
                .StartSignInWithTwitter(callback)
                .Headers["Location"];
        }
예제 #2
0
        public BasicUserData ProcessAuthRequest(ProcessAuthenticationContext context)
        {
            string screenName;
            int userId;

            var consumer = new TwitterConsumer(context.SessionStorage);
            return consumer.TryFinishSignInWithTwitter(out screenName, out userId)
                ? new BasicUserData
                        {
                            UserId = userId.ToString(CultureInfo.InvariantCulture),
                            UserName = screenName,
                            PictureUrl = string.Format("http://api.twitter.com/1/users/profile_image/{0}.png", screenName)
                        }
                : null;
        }