开发者

Facebook connect for mobile app

EDIT - Closer. Need to have a port number for my callback url.

i.e. http://127.0.0.1:1234

Problem is that port is dynamic and constantly changing. Has anyone ran into this before?


Working with rhomobile. Need some help to better understanding h开发者_开发知识库ow facebook oauth2 works.

when user launches app for the first time want to do facebook connect to get user info and post to wall when user comments.

Assume I can do the following:

Have a button which calls an Action in my Controller. -> Action launches WebView to FB mobile for authentication -> User enters credentials on FB -> on redirect_uri_controller gets auth_code and I do a AsyncHttp.get requesting token with another redirect_url -> lands redirect_url & auth_token stored.

Right now, have a button that calls the below controller

def fb_initiate_connect
  call_back_url = url_for(:controller => "Settings", :action => :fb_initiate_connect_callback)
  url = "http://www.facebook.com/dialog/oauth?client_id=#{fb_app_id}&redirect_uri=#{call_back_url}&scope=email,read_stream,publish_stream&display=touch"
  WebView.navigate(url)
end

This launches a UIWebview in my app, goes to FB mobile site but getting "An error occurred with APP_NAME. Please Try again later."

Think its because cookie is not being set/found? Everything in here is pretty much manual so would have to do something like WebView.execute_js("document.cookie=WHAT?;") But do I put this in my call_back_url or fb_initiate_connect?


Yes, Rhodes dynamically configures the port because specifying an explicit port may conflict with another port being used on the device by another Rhodes application or anything else on the device.

You can force the port on which your application runs in the RhoConfig.txt, with the property:

local_server_port = 8080

However, the best solution would be to get the dynamic server port by:

System.get_property('rhodes_port') 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜