|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Facebook canvas application in CatalystHi,
I am trying to write a Facebook canvas application in Catalyst using the WWW::Facebook::API plugin and I am tearing my hair trying to get it to work. I have no problems with access to my canvas application from Facebook, but I am unable to use any of the $c->facebook interface methods to acquire user data, eg. friend list, event information etc. I would be very grateful if anyone could post an example of, for instance, getting the currently logged in user's friends, or event information or any information at all via the $c->facebook interface. All I get is error when using the methods in the interface and the problem is definitely on this side of the keyboard. KR, Gunnar _______________________________________________ List: Catalyst@... Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@.../ Dev site: http://dev.catalyst.perl.org/ |
|
|
Re: Facebook canvas application in CatalystOn Thu, Oct 15, 2009 at 12:25 PM, Gunnar Strand <gunnarstrand@...> wrote: Hi, Hi Gunnar, I've been meaning to write a blog entry on this, since there are some points to be aware of. I've built my own model that creates a per-context instance and works quite well. It isn't on CPAN (yet) but I should probably release it. I would advise against using the Plugin, as it's not modifying the application behavior or dispatching so having it as a plugin is a bad fit. I posted my code in a gist: http://gist.github.com/211218 Keep in mind that you can't do differentiation on request type like GET/POST through the canvas. Make sure that you have the application added to your profile (check the app added, there is a chain mid-point to do this in the gist). Hope this helps, -J -- J. Shirley :: jshirley@... :: Killing two stones with one bird. http://our.coldhardcode.com/jshirley/ _______________________________________________ List: Catalyst@... Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@.../ Dev site: http://dev.catalyst.perl.org/ |
|
|
Re: Facebook canvas application in CatalystFrom: J. Shirley <jshirley@...> To: The elegant MVC web framework <catalyst@...> Sent: Thu, October 15, 2009 9:44:13 PM Subject: Re: [Catalyst] Facebook canvas application in Catalyst On Thu, Oct 15, 2009 at 12:25 PM, Gunnar Strand <gunnarstrand@...> wrote: Hi, Hi Gunnar, I've been meaning to write a blog entry on this, since there are some points to be aware of. I've built my own model that creates a per-context instance and works quite well. It isn't on CPAN (yet) but I should probably release it. I would advise against using the Plugin, as it's not modifying the application behavior or dispatching so having it as a plugin is a bad fit. I posted my code in a gist: http://gist.github.com/211218 Keep in mind that you can't do differentiation on request type like GET/POST through the canvas. Make sure that you have the application added to your profile (check the app added, there is a chain mid-point to do this in the gist). Hope this helps, -J Hi J, Thank you for the quick reply! I have looked through the code and I cannot understand what the problem is for me. I have tried making this as simple as possible to eliminate any potential errors and still don't get it to work. I removed the plugin and I now have this code in the top index, some shamelessly copied from your page :-): sub index : Path : Args(0) { my ( $self, $c ) = @_; my $client = new WWW::Facebook::API( app_id => '174563349128', api_key => 'ce82845d86baa6d633efa5f00d83575a', desktop => 0, secret => '<secret id>', ); my $params = $c->req->params; my $fb_params = $client->canvas->get_fb_params( $c->req ); if ( $params->{'auth_token'} ) { $client->auth->get_session( $params->{'auth_token'} ); } if ( $fb_params->{session_key} ) { $client->session_key( $fb_params->{session_key} ); } use Data::Dumper; my $output = Dumper( $client->friends->get ); $c->response->body( '<pre>' . $output . '</pre>' ); And the output is still: $VAR1 = {I've rechecked the api_key and secret, and they are correct. I guess that that the source above really should product useful output? KR, Gunnar _______________________________________________ List: Catalyst@... Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@.../ Dev site: http://dev.catalyst.perl.org/ |
|
|
Re: Facebook canvas application in CatalystOn Thu, Oct 15, 2009 at 1:22 PM, Gunnar Strand <gunnarstrand@...> wrote:
Minimize what you're doing. Just do: $c->log->_dump( $client->users->is_app_user ); Work from there, then try to make requests. It sounds like you have something misconfigured. Make sure you also have the latest JSON and JSON::XS installed, too. It could be something there (wild guess) -J _______________________________________________ List: Catalyst@... Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@.../ Dev site: http://dev.catalyst.perl.org/ |
| Free embeddable forum powered by Nabble | Forum Help |