Friday, December 24, 2010

Facebook OAuth - more information

Recently, I had to incorporate OAuth for Facebook.

I ran into a few issues.

First and foremost, I had a "Invalid redirect_uri: Given URL is not allowed by the Application configuration" error.

After some trolling on the net, I found that this can be corrected by Url-encoding the redirect_uri parameter.

Using C#, you can fix this by simply, using the Server.UrlEncode function.



Then, I hit a "Error validating verification code." error.

This is fixed by using a Http-GET rather than a Http-POST to retrieve the information.

To do this, simply do the following.
1. Instantiate a URI object and passing the https://graph.facebook.com/oauth/access_token with relevant parameters. See here for more info.
2. Create a HttpWebRequest object.
3. Setting the http web request "method" attribute to GET.
4. Create a HttpWebResponse object.
5. Create a stream reader object and this should return you the access_token values.



To log-in without a user, simply add "&type=client_cred" to 1.

Monday, December 6, 2010

MS Chart Visual Studio 2008 Add-On - Error executing child

I installed MS Chart Add-On for Visual Studio 2008, compiled the project and hit the "Play" button and received a yellow error screen as the below.





To fix this issue, what you have to do is to simply add an additional "verb" to the "httpHandlers" section within the "system.web" section of the ROOT web.config file.

See below for an example

<add verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />


I found this fix at handy Stack-Overflow. Click here

Wednesday, December 1, 2010

Google maps - Overcoming rotating label text for the x-axis

Recently, I had to integrate with Google Charts and ran into the problem of rotating the labels of the x-axis. There isn't a fix for this, however, I manage to do a work around by shortening the labels on the x-axis and creating a legend to explain what the labels meant.

Click here for a sample Google chart.