"Invalid API key" error

May 16, 2008 at 3:05 PM
Hello everyone,

this may be a stupid question but i am not too familiar with the whole facebook authentication process, and i am having a bit of a problem understanding some details.

Basically i am getting Facebook.Exceptions.FacebookException "Invalid API key" after the application / browser is idle for some time. I think this only happes when a facebook user, when adding my app, chooses 'not to be kept logged in all the time'. I think it has to do with infinate sessions; i am guessing the session key i obtained becomes invalid after some time?

I did not have the time to research this in detail but I was hoping that the toolkit would take care of all that. Is there a simple solution to this inside the toolkit? I am really confused about this as i could not find anything about this in the toolkit documentation...

Any help or guidance would be greatly appreciated!
Thanks,
Greg
May 16, 2008 at 6:49 PM
he he, please ingore this one :)

the problem was simply due to forgetting to call base.Page_Load(sender,e) in my Page_Load function for pages derived from 

CanvasIFrameBasePage

May 16, 2008 at 9:25 PM
he he, please ingore this one :)

the problem was simply due to forgetting to call base.Page_Load(sender,e) in my Page_Load function for pages derived from 

CanvasIFrameBasePage

Aug 28, 2008 at 3:27 PM
Edited Aug 28, 2008 at 3:28 PM
I'm getting the Invalid Api Key error on my initial page load.  I'm using a web page that has a master page that inherits from CanvasIFrameMasterPage.  I've verified that WebConfigurationManager.AppSettings("apikey") does in fact return my API key, but when I call Master.API.ApplicationKey it returns nothing.
This is my page load event of the page:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim api As String = WebConfigurationManager.AppSettings("apikey") 'Returns my api key
        api = Master.API.ApplicationKey 'Returns nothing
        lvwFriends.DataSource = Master.API.friends.getUserObjects() 'Invalid Api Key error is thrown
        lvwFriends.DataBind()
    End Sub

This is my master page:

Partial Public Class FacebookMasterPage
    Inherits CanvasIFrameMasterPage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        MyBase.OnLoad(e)
    End Sub

End Class
Aug 28, 2008 at 9:05 PM
Found the solution.  AutoEventWireup was set to false in my master page, so the base page event methods were not being called.