authenticating my canvas application

71 views
Skip to first unread message

Roman

unread,
Aug 11, 2010, 5:48:29 AM8/11/10
to RestFB
Hi,
I want to write a fb canvas application and use RestFB library in
order to communicate with facebook. I would like to use a new oauth
2.0 protocol for authentication and get a access_token, however I am
having trouble with redirect_uri argument:
If I provide a full url path to my server "www.example.com/callback",
facebook redirects directly to it and it does not stay in facebook's
iframe. And if I provide a relative url, the authentication request
gets rejected with an error.
1. Do you know if it's possible to use oauth 2.0 for canvas
applications?
2. If it's not possible, then how can I use RestFB for canvas
applications ? Does RestFB provide login functionality using the old
authentication protocol?

Christopher Östlund

unread,
Aug 11, 2010, 6:38:00 AM8/11/10
to res...@googlegroups.com
You need to set display to page, to get the whole facebook page included. I think it's default set to popup, which is without the facebook header and such.

Roman Gershman

unread,
Aug 11, 2010, 10:58:23 AM8/11/10
to res...@googlegroups.com
It does not work. The redirect url that my application is sending is: 

Why redirection itself is sent using the following code:

 String out = "<html><script type=\"text/javascript\">\ntop.location.href = \"" + url
                    + "\";\n</script></html>";
 resp.setHeader("Content-Type", "text/html");
 resp.getWriter().print(out);
resp.flushBuffer();


2010/8/11 Christopher Östlund <christophe...@gmail.com>



--
Best regards,
     Roman

revetkn

unread,
Aug 11, 2010, 11:30:09 AM8/11/10
to RestFB
Hi Roman -

> 2. If it's not possible, then how can I use RestFB for canvas
> applications ? Does RestFB provide login functionality using the old
> authentication protocol?

For the record, as of now there are no plans to add authentication/
authorization support to RestFB - it's up to your application to use
Facebook Connect to get access tokens etc.

There are a bunch of threads out there discussing problems people have
had using the OAuth scheme with Canvas apps - maybe this one will be
helpful for you (I am not an expert on Canvas apps so unfortunately I
don't think I'd be of much help):
http://stackoverflow.com/questions/2739153/facebook-canvas-iframe-app-authorizing-users-with-new-oauth-protocol

Good luck!

Thanks
Mark

On Aug 11, 10:58 am, Roman Gershman <roma...@gmail.com> wrote:
> It does not work. The redirect url that my application is sending is:https://graph.facebook.com/oauth/authorize?client_id=....&display=pag...
>
> Why redirection itself is sent using the following code:
>
>  String out = "<html><script type=\"text/javascript\">\ntop.location.href =
> \"" + url
>                     + "\";\n</script></html>";
>  resp.setHeader("Content-Type", "text/html");
>  resp.getWriter().print(out);
> resp.flushBuffer();
>
> 2010/8/11 Christopher Östlund <christopher.oestl...@gmail.com>
>
>
>
> > You need to set display to page, to get the whole facebook page included. I
> > think it's default set to popup, which is without the facebook header and
> > such.
>
Reply all
Reply to author
Forward
0 new messages