Authenticate using openID without login through provider

Posted by thabet084 on Stack Overflow See other posts from Stack Overflow or by thabet084
Published on 2010-12-23T09:52:00Z Indexed on 2010/12/23 9:53 UTC
Read the original article Hit count: 257

Filed under:
|
|
|

Dear all ,

I create web application to connect to MySpace Offsite App and I want to authenticate I used the following code

var openid = new OpenIdRelyingParty();
            IAuthenticationRequest request = openid.CreateRequest("http://www.myspace.com/thabet084");
            request.AddExtension(new OAuthRequest("OAuthConsumerKey"));
            request.RedirectToProvider();
            var response = openid.GetResponse();
            OAuthResponse oauthExtension = new OAuthResponse();
            if (response != null)
            {

                switch (response.Status)
                {
                    case AuthenticationStatus.Authenticated:
                        oauthExtension = response.GetExtension<OAuthResponse>();
                        var user_authorized_request_token = oauthExtension.RequestToken;
                        break;
                }
            }
             OffsiteContext context = new OffsiteContext("ConsumerKey", "ConsumerSecret");

            var accessToken = (AccessToken)context.GetAccessToken(oauthExtension.RequestToken, "", "");

and I used the following refrences DotNetOpenAuth.dll and MySpaceID.SDK.dll

My problems are:

  1. I always found that responce=null
  2. I don't need user to login through provider MySpace so i need to remove RedirectToProvider();

My application in brief is to send status from mywebsite to MySpace account Just click on button to send

All ideas are welcome

BR, Mohammed Thabet Zaky

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET