I have an app written in Asp.Net MVC and Jquery. The app has a functionality to post a message to facebook wall.
When the user clicks the post button on my custom dialog, i do a redirect to
"https://www.facebook.com/dialog/oauth?client_id=xxxx&display=popup&redirect_uri=http://localhost:xxxx/Posts/AuthorizeFaceBook&scope=publish_stream"
using Jquery. And once the user completes log in to facebook my callback is getting executed without any issues. But how can i pass my Post message to the call back from the original custom dialog?
Is storing the message string in a Session, is the only to way to access the message from the callback ?
Thanks !
You need to include the parameters in your redirect URL. You must also uri encode the redirect URL.
Related
I'm using rails to send an email to log in a user through a link. In that email I have a button and link that both use the same url but with the button I'm getting a 404 error while using google or yahoo's main site to view the email. While using third party email portals I don't seem to have this issue. The link works in all circumstances.
In the view for the email template, I'm using the button_to tag for the button that will redirect the user to the site to log them in. Which I noticed puts the button into a form. So I was wondering if this was a safety measure by google and yahoo to prevent potential threats and I need to refactor to just have a button without the form element, or could it be an issue with my code?
When I click "Enable" for my skill from https://alexa.amazon.com I am redirected to my application login page, after entering email/password and successful authentication I am redirecting user to
https://pitangui.amazon.com/api/skill/link/M2SH60C21FLV91?vendorId=M2SH60C21FLV91&state=A2SAAEAEOlVnPYTaS9OqN_iQmxOIpEBkLSBUPLDHJGzHc_ALJ02fPLzMm9OYOMG9mpSuDVg3_O3fgpSE5iCfh3XCLBs0oTay3Eqr6CEXpU7eDf_11PeUJCk839z0cxc8djFlxbLUr_CINPUNtVoHfzpn3Ztwl4OE-2dcKmqLiza6C9cr7Ca8-8UmEdshagKsue4lYkyWFiFwx-Yg452QHIY0DpnG1rtbanQgW5MjgbTaR3-MPy7QBIodnF_SnbtXpWb69_R3HOlGHPoaJgIbi2yr1lc-fIJbJ8B8Zbzm0mMi2IocOg4fDrFlwQ6ZRUXzeWB6ZapbxfeO4UR3h8Cr3P9_efaRFFgD4NZPL3DkAdlSF2XlAmKIpg5xr3u25jt-vHZi50QWJYgZYLDCJFqrnDoGSVIwLGz1vKFnZCkAYm7ioJ_emq5JtkfBVQaxg2mH2_pcvadbE8DgufJCt0QkDMp94eyRbYKp2uKsdVZNuV_PwGdb1AFVQhzDqbiE0pyMfbjSpWjcTM8CAbdfSGsbxJ3ipcSV6LSjbokH1KP5vLAAVr5wQIRSDA&access_token=WFA0UWlxcTFCZVZnTmJmUmdldUF3dVFwdG1VSGM0aWJSODB1OUVkNTdUST06a2F1c2hhbEBuaWNoZXRlY2guaW46NjM2NDY0MzM2OTAwNzU3NjYy&token_type=Bearer
but it gives me JSON response
"{"httpRedirectLocation":"https://skills-store.amazon.com/api/skill/link/M2SH60C21FLV91?access_token=WFA0UWlxcTFCZVZnTmJmUmdldUF3dVFwdG1VSGM0aWJSODB1OUVkNTdUST06a2F1c2hhbEBuaWNoZXRlY2guaW46NjM2NDY0MzM2OTAwNzU3NjYy&state=A2SAAEAEOlVnPYTaS9OqN_iQmxOIpEBkLSBUPLDHJGzHc_ALJ02fPLzMm9OYOMG9mpSuDVg3_O3fgpSE5iCfh3XCLBs0oTay3Eqr6CEXpU7eDf_11PeUJCk839z0cxc8djFlxbLUr_CINPUNtVoHfzpn3Ztwl4OE-2dcKmqLiza6C9cr7Ca8-8UmEdshagKsue4lYkyWFiFwx-Yg452QHIY0DpnG1rtbanQgW5MjgbTaR3-MPy7QBIodnF_SnbtXpWb69_R3HOlGHPoaJgIbi2yr1lc-fIJbJ8B8Zbzm0mMi2IocOg4fDrFlwQ6ZRUXzeWB6ZapbxfeO4UR3h8Cr3P9_efaRFFgD4NZPL3DkAdlSF2XlAmKIpg5xr3u25jt-vHZi50QWJYgZYLDCJFqrnDoGSVIwLGz1vKFnZCkAYm7ioJ_emq5JtkfBVQaxg2mH2_pcvadbE8DgufJCt0QkDMp94eyRbYKp2uKsdVZNuV_PwGdb1AFVQhzDqbiE0pyMfbjSpWjcTM8CAbdfSGsbxJ3ipcSV6LSjbokH1KP5vLAAVr5wQIRSDA&token_type=Bearer"}"
and page stops, it does not enable and redirect back to alexa giving success message.
I have to manually copy-paste the url which I get in above json response, then only my account is linked.
Can anyone help why I am not directly redirect and getting the successfully linked page? Why I have to manually copy-paste the url?
Thanks in advance.
you cannot pass accesstoken as a query param in the redirect url. Appending # before the accesstoken will work.
...IRSDA#access_token=WFA...
I am able to redirect now.
I missed "#" after vendorId.
"https://pitangui.amazon.com/spa/skill/account-linking-status.html?vendorId=AAAAAAAAAAAAAA#state=xyz&access_token=XXXXX&token_type=Bearer"
Reference url: https://developer.amazon.com/docs/custom-skills/link-an-alexa-user-with-a-user-in-your-system.html#h3_login_req
Thanks all
Will I able to invoke a button action ( HTTP Post/Get) through swift? I searched few posts and I am able to retrieve the contents from a web page. But I am not able to post anything. Say, web page has a login screen and the user needs to enter user name and password and click submit. How do I do this? note: The website I am using doesnt use URL parameters
Any help is highly appreciated. Thanks
I'm developing a desktop application which is supposed to allow users to login via Twitter.
There seems to be 2 ways to do so, that differ in a way oauth_verifier is returned to the application.
The first one is for web applications and oauth_verifier is returned as a url query parameter when redirecting user back to redirect_url.
The second one is using a PIN displayed to the user, which user enters to the app.
Now Facebook, for example, has a page facebook.com/connect/login_success.html , where FB can redirect a user with ouath_verifier as a query param (e.g. facebook.com/connect/login_success.html?code=<token>. Then I can read that param back from the browser's location field (I'm using an embedded browser).
So, is such a workflow possible with Twitter? Does it have a static page, where it can redirect user with oauth_verifier ?
I haven't been able to find such a page in Twitter's API docs, so I ended up using the main page twitter.com for the redirect. Everything works fine.
I am embedding a Facebook app https://example.com into the Facebook app canvas so that it is available at https://apps.facebook.com/EXAMPLE . My application sends notification emails that contain links like https://example.com/messages/123 and that should open the page embedded into the Facebook canvas. How do I achieve this? My current thoughts:
User opens https://example.com/messages/123
Application checks for signed_request parameter
Application redirects user to https://apps.facebook.com/EXAMPLE/?requested_page=/messages/123
Application checks for requested_page parameter and redirects to this page
User sees https://example.com/messages/123 URL and is embedded into canvas
Is there a better pattern out there to get this working?
My final working solution (with Ruby on Rails)
User opens https://example.com/messages/123
Application checks on client-side if app is embedded in canvas:
if(window == top){
top.location = "https://apps.facebook.com/#{Settings.facebook.app_id}#{request.fullpath}";
}
User is redirected to https://apps.facebook.com/EXAMPLE/messages/123
Application middleware converts POST into GET if signed_request is present (code and idea borrowed from https://github.com/dekart/facebooker2/blob/master/lib/facebooker2/rack/post_canvas.rb)
Application parses signed_request with fb_graph gem
FbGraph::Auth.new(app_id, app_secret, :signed_request => params[:signed_request])
I'd just update the link to point to http://apps.facebook/example/messages/123 off the start.
When you check for authentication just set the redirect after authorization/login to the same page.
Redirecting a user around multiple pages for no reason is just not a good practice.