[Opa] Facebook integration, escaping and namespaces in xhtml

Dmitry Degtyarev ddegtyarev at gmail.com
Tue Sep 20 09:56:06 EDT 2011


Adam,

Thanks for the explanation.
I ended up with a snippet like this (ids changed) - and it works:

Fb = {{
  config = {app_id = "177531045345345851"; api_key = "172343243243248851";
app_secret = "1ec21cfab345435a7c73453453455eef9fb28"}
  auth = FbAuth(config)
  permissions = [{user_photos : {}}]
  login(redirect_url) = <a href="{auth.user_login_url(permissions,
redirect_url)}">Connect using Facebook</a>
}}

Is this the intended way of using FbAuth?

Dmitry

On Tue, Sep 20, 2011 at 4:59 PM, Adam Koprowski
<Adam.Koprowski at mlstate.com>wrote:

>    Dear Dmitry,
>
>   Embedding <script> references and custom JS within web pages can easily
> be unsafe and hence is *not* a recommended thing to do in Opa and
> therefore it requires serious gymnastics to accomplish.
>
>   In general: preferred way to use external scripts would be to bundle them
> as a plug-in: http://doc.opalang.org/#_bindings_with_other_languages
>
>   For Facebook: did you take a look at stdlib.api.facebook<http://opalang.org/resources/doc/index.html#facebook.opa.html/!/value_stdlib.apis.facebook.Facebook> --
> Opa's library for binding with Facebook?
>
>   Best,
>   Adam
>
> On Tue, Sep 20, 2011 at 14:19, Dmitry Degtyarev <ddegtyarev at gmail.com>wrote:
>
>> Hello,
>>
>> This is my first post to the list. I find OPA very promising and currently
>> in the process of building a niche social network with it.
>>
>> Three questions:
>>
>> 1. What is the most straightforward and recommended way of creating a
>> Facebook Login button on a page?
>> I've created a function to do that:
>>
>> FacebookLogin = {{
>>   html(id) = <>
>>     <div id="fb-root"></div>
>>     <script src="http://connect.facebook.net/en_US/all.js"></script>
>>      <script>{"FB.init(\{appId:'{id}', cookie:true, status:true,
>> xfbml:true\});"}
>>     </script>
>>     <fb:login-button>Login with Facebook</fb:login-button>
>>   </>
>> }}
>>
>> The next questions came up when I tried to compile this...
>>
>> 2. How do I escape curly braces inside xhtml? \{ didn't work for me, so I
>> had to use string insertion, which I find ugly
>>
>> 3. How do I use namespaces inside xhtml? The sample above does not
>> compile, saying
>> the variable xmlns:fb is unbound.
>> Hint:
>>   Perhaps you meant xmlns: or Xmlns ?
>>
>> Should I use @xml? Simply replacing <> with @xml( doesn't solve the
>> problem
>>
>> Regards,
>> Dmitry
>>
>> _______________________________________________
>> Opa mailing list
>> Opa at lists.owasp.org
>> https://lists.owasp.org/mailman/listinfo/opa
>>
>>
>
>
> --
> *Adam Koprowski  [http://adam-koprowski.net]
> R&D @ MLstate   [http://opalang.org | http://mlstate.com] *
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.owasp.org/pipermail/opa/attachments/20110920/71951d14/attachment.html 


More information about the Opa mailing list