MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Twitter login issue  (Mono Support )

Viewed 27154 time(s), 11 post(s) 6/13/2014 11:47:19 AMby Zoomicon

Related topics

Zoomicon

Zoomicon

6/13/2014 11:47:19 AM

I'm trying to add Twitter login to http://social.clipflair.net (have already Facebook login working OK there)

and I'm taken to an IIS error page

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.

at http://apps.twitter.com I wonder what value I should enter for callback URL. Is there some article showing step-by-step instructions/screenshot for monox and dotnetopenauth? Trying using ..../login.aspx, the site root and also empty url with the same error (wonder if it even calls into twitter in the first place)

---- In the logs I see: ---

2014-06-13 14:31:03,585 [16] ERROR MonoX [150.140.28.38] - Error
</br>System.InvalidOperationException: Sequence contains no elements
</br>   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
</br>   at Brickred.SocialAuth.NET.Core.ProviderFactory.GetProvider(PROVIDER_TYPE requestedProvider)
</br>   at Brickred.SocialAuth.NET.Core.BusinessObjects.SocialAuthUser.Connect(PROVIDER_TYPE providerType, String returnURL, String errorURL, Boolean skipRedirectionIfAlreadyConnected)
</br>   at MonoSoftware.MonoX.ModuleGallery.LoginSocial.Login(PROVIDER_TYPE selectedProvider)
</br>   at MonoSoftware.MonoX.ModuleGallery.LoginSocial.btn_Click(Object sender, EventArgs e)
</br>   at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
</br>   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
</br>2014-06-13 14:31:03,585 [16] ERROR MonoX [BaseHttpApplication] - Application Error
</br>System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.InvalidOperationException: Sequence contains no elements
</br>   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
</br>   at Brickred.SocialAuth.NET.Core.ProviderFactory.GetProvider(PROVIDER_TYPE requestedProvider)
</br>   at Brickred.SocialAuth.NET.Core.BusinessObjects.SocialAuthUser.Connect(PROVIDER_TYPE providerType, String returnURL, String errorURL, Boolean skipRedirectionIfAlreadyConnected)
</br>   at MonoSoftware.MonoX.ModuleGallery.LoginSocial.Login(PROVIDER_TYPE selectedProvider)
</br>   at MonoSoftware.MonoX.ModuleGallery.LoginSocial.btn_Click(Object sender, EventArgs e)
</br>   at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
</br>   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
</br>   at System.Web.UI.Page.HandleError(Exception e)
</br>   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
</br>   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
</br>   at System.Web.UI.Page.ProcessRequest()
</br>   at System.Web.UI.Page.ProcessRequest(HttpContext context)
</br>   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
</br>   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
</br>

This content has not been rated yet. 
2793 Reputation 345 Total posts
Zoomicon

Zoomicon

6/13/2014 12:47:15 PM

trying to set up Google login via https://console.developers.google.com

I saw it was complaining that http://social.clipflair.net/socialauth/validate.sauth wasn't registered at google as valid callback url, so I used that callback URL at Twitter too (at http://apps.twitter.com), but now it goes to Twitter and returns back immediately showing our login UI again (we need to remove a fancybox we had added there), wonder if that is expected behaviour (Twitter to callback immediately before the user gets a chance to do something). Is it some part of the protocol?

I see

2014-06-13 15:23:16,038 [67] INFO  OAuth1_0a [(null)] - OAuth1.0a Authorization Flow begins for TWITTER...
</br>2014-06-13 15:23:17,037 [67] INFO  OAuth1_0a [(null)] - Request Token successfully received
</br>2014-06-13 15:23:18,612 [68] INFO  OAuth1_0a [(null)] - User returns from provider
</br>2014-06-13 15:23:18,612 [68] INFO  OAuth1_0a [(null)] - User successfully logged in and returned
</br>2014-06-13 15:23:19,005 [68] INFO  OAuth1_0a [(null)] - Access token successfully received
</br>2014-06-13 15:23:19,020 [68] INFO  OAuth1_0a [(null)] - OAuth1.0a Authorization Flow ends...

in MonoX_Info.log

--- and in MonoX.log I see:

2014-06-13 15:23:40,028 [61] ERROR OAuth1_0a [(null)] - An error occurred while executing http://api.twitter.com/1.1/users/show.json?user_id=40986....
</br>Request Parameters: oauth_consumer_key=...&oauth_nonce=4515894&oauth_signature_method=HMACSHA1&oauth_timestamp=1402662220&oauth_token=409868535-jFCKRohwPLIhIXrhfw5kgAA......zlOdc&oauth_version=1.0&oauth_signature=......+8W0XVAuNops=
</br>System.Net.WebException: The remote server returned an error: (403) Forbidden.
</br>The remote server returned an error: (403) Forbidden.
</br>   at Brickred.SocialAuth.NET.Core.OAuth1_0a.ExecuteFeed(String feedURL, IProvider provider, Token connectionToken, TRANSPORT_METHOD transportMethod)
</br>   at Brickred.SocialAuth.NET.Core.Wrappers.TwitterWrapper.GetProfile()
</br>   at Brickred.SocialAuth.NET.Core.BusinessObjects.SocialAuthUser.GetProfile(PROVIDER_TYPE providerType)
</br>   at MonoSoftware.MonoX.ModuleGallery.LoginSocial.CheckCredentials()

and in Mono_Debug.log:
</br>
</br>2014-06-13 15:23:40,309 [33] DEBUG TwitterWrapper [(null)] - Executing Profile feed
</br>2014-06-13 15:23:40,309 [33] DEBUG OAuthHelper [(null)] - signature base:GET&http%3A%2F%2Fapi.twitter.com%2F1.1%2Fusers%2Fshow.json&oauth_consumer_key%3DPRF........%26oauth_nonce%3D1660844%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1402662220%26oauth_token%.....%26oauth_version%3D1.0%26user_id%3D409868535
</br>2014-06-13 15:23:40,309 [33] DEBUG OAuthHelper [(null)] - HMACSHA1 signature:.....=
</br>2014-06-13 15:23:40,309 [33] DEBUG OAuthHelper [(null)] - Authorization Header: OAuth oauth_consumer_key="PR....5sw", oauth_nonce="1660844", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1402662220", oauth_token="....", oauth_version="1.0", oauth_signature="....lOd8%3D"
</br>2014-06-13 15:23:40,309 [33] DEBUG OAuth1_0a [(null)] - Executing http://api.twitter.com/1.1/users/show.json?user_id=4098....5 using GET

This content has not been rated yet. 
2793 Reputation 345 Total posts
mzilic

mzilic

6/13/2014 1:32:00 PM
Hello,

Please try setting the callback url on the twitter developer site to just point to your domain only ex. http://mono-software.com. I just tried the Twitter login and it seems to work as expected with the following approach. However, please have in mind that Twitter has an extra login step requirement for new users on the site. The Twittter API doesn't return an e-mail address so in the Twitter SN login scenario MonoX will ask a user for a valid e-mail address as well (see attached).

To configure Google login on the Google API console create a new Client ID and select Web Application as the Application type. Please ensure that the redirect URI points towards the socialauth handler. For example: http://{mydomain}/socialauth/validate.sauth. Unfortunately you must specify the socialauth handler due to the Google API limitations.

Regards,
Mario
This content has not been rated yet. 
2218 Reputation 300 Total posts
Zoomicon

Zoomicon

6/13/2014 2:14:14 PM

I still get

</br>

</br>"2014-06-13 17:06:52,224 [86] ERROR MonoX [150.140.47.54] - An error occurred while executing http://api.twitter.com/1.1/users/show.json?user_id=86805649

</br>Request Parameters: oauth_consumer_key=...&oauth_nonce=2604052&oauth_signature_method=HMACSHA1&oauth_timestamp=1402668412&oauth_token=.......&oauth_version=1.0&oauth_signature=...

</br>Forbidden!

</br>The remote server returned an error: (403) Forbidden.

</br>   at Brickred.SocialAuth.NET.Core.OAuth1_0a.ExecuteFeed(String feedURL, IProvider provider, Token connectionToken, TRANSPORT_METHOD transportMethod)

</br>   at Brickred.SocialAuth.NET.Core.Wrappers.TwitterWrapper.GetProfile()

</br>   at Brickred.SocialAuth.NET.Core.BusinessObjects.SocialAuthUser.GetProfile(PROVIDER_TYPE providerType)

</br>   at MonoSoftware.MonoX.ModuleGallery.LoginSocial.CheckCredentials()"

Twitter supports only OAuth 1.x and not 2.x?

Maybe it's some setting at the app rights? I have it set at twitter for read permission only, should I set it to ask for more?



the modes to select there are:

-  Read only

-



(speaking of access rights, the FB login setting in web.config is asking for too many rights I think, some of them don't show by default to users since FB asks that you do a request for them to review your app and allow them - also it asks the user for permission to post on their behalf, why? Is MonoX using this anywhere?)


Also there is a checkbox at http://apps.twitter.com on whether you want the app to allow Twitter sign-in, but not sure if that is only for their own sign-in button for sites
This content has not been rated yet. 
2793 Reputation 345 Total posts
Zoomicon

Zoomicon

6/13/2014 2:20:45 PM
I tried all settings regarding access rights at Twitter app and keeps on doing the same thing
This content has not been rated yet. 
2793 Reputation 345 Total posts
mzilic

mzilic

6/13/2014 2:58:03 PM
Hello,

The error seems to indicate that Twitter is rejecting your App Keys. Can you ensure that the keys entered in web.config are the same as on the Twitter dev site?

Regards,
Mario
This content has not been rated yet. 
2218 Reputation 300 Total posts
Zoomicon

Zoomicon

6/13/2014 5:43:24 PM

I noticed in Google that when I regenerated the API keys it went from OAuth1.x to OAuth2.0 (obviously I had created them a long time ago when experimenting with RPX)

So I did the same after your suggestion for Twitter, but it still isn't behaving ok

I'm also having a problem with LinkedIn which is failing to show the authentication page in IE and in Mozilla it says the page compression is not supported ??? Very strange

This content has not been rated yet. 
2793 Reputation 345 Total posts
Zoomicon

Zoomicon

6/13/2014 5:45:22 PM

btw, at Google login, I used AdditionalScopes="https://www.googleapis.com/auth/userinfo.profile, https://www.googleapis.com/auth/userinfo.email" and it shows a prompt to the user at authentication that their e-mail will be accessed, but still your login asks the user about their e-mail. Maybe you've hardcoded that for Google or something? Why isn't it enough to add https://www.googleapis.com/auth/userinfo.email

This content has not been rated yet. 
2793 Reputation 345 Total posts
mzilic

mzilic

6/16/2014 9:29:33 AM
I noticed in Google that when I regenerated the API keys it went from OAuth1.x to OAuth2.0 (obviously I had created them a long time ago when experimenting with RPX)

Yes, Google made mandatory OAuth 2.0 couple of months ago.

So I did the same after your suggestion for Twitter, but it still isn't behaving ok

Can you provide more information about the current behavior now?

I'm also having a problem with LinkedIn which is failing to show the authentication page in IE and in Mozilla it says the page compression is not supported ??? Very strange

Which authentication page is showing you the following error? On MonoX's end or on LinkedIn end?

btw, at Google login, I used AdditionalScopes="https://www.googleapis.com/auth/userinfo.profile, https://www.googleapis.com/auth/userinfo.email" and it shows a prompt to the user at authentication that their e-mail will be accessed, but still your login asks the user about their e-mail. Maybe you've hardcoded that for Google or something? Why isn't it enough to add https://www.googleapis.com/auth/userinfo.email


No, it's not hardcoded for Google+. Can you try using the following AdditionalScopes: openid profile email, ex:
AdditionalScopes="openid profile email"

Regards,
Mario
This content has not been rated yet. 
2218 Reputation 300 Total posts
Zoomicon

Zoomicon

6/21/2014 10:16:31 PM
I thought at first look that all scopes Google uses are in form of URLs, but maybe the default ones defined by OAuth2.0 are just keywords like the "openid profile email" you say so I'll try it (btw, is there any document from OAuth2.0 that defines those scope names?)
This content has not been rated yet. 
2793 Reputation 345 Total posts
1 2