Facebook canvas app dialog redirect - asp.net-mvc

Wanna execute user-to-user request dialog initiated by server side.
On my FB canvas application I have button "invite my friends". After user presses it, the POST request goes to my server and i redirect to FB request dialog using the following C# MVC code:
return Redirect("http://www.facebook.com/dialog/apprequests?app_id=MY_APP_ID&message=MESSAGE&redirect_uri=MY_APP_CANVAS_URL");
What i'm getting on Facebook canvas instead of "select users" dialog is the blank page with the FB logo href-ed to target page. How do i this confirmation to disappear?

Facebook typically doesn't allow for the content of a canvas page to be one of their dialog URLs. The way most developers work around this is to issue a client-side redirect to an absolute URL that redirects the entire page, instead of just the canvas iframe content.
For your purposes, you can achieve this by serving a minimal page as the response to the POST request that contains the following markup:
<script>
top.location="<%= (insert apprequest dialog URL here) %>";
</script>

Related

WebView Navigating event is working for .aspx page but not working for ashx page Xamarin Forms

I have created a Single Sign On Integration For Mobile App using Webview in Xamarin Forms.
I have initialized my webview Source as
webview.Source="https://dev-146240.oktapreview.com/oauth2/default/v1/authorize?client_id=0oaecgo3lfDfsW5YX0h7&redirect_uri=https://192.168.1.15/workingN/SERVICES/SSOHandler.ashx&response_type=code&scope=openid&login_hint=ankur.gupta#kanrad.com&state=OFFLINE_ankur.gupta#kanrad.com";
Here I have given redirect_uri on which the page gets navigated after the successfull authentication from the third party.So,in my redirect_uri web page i am redirecting the page to some (blank.html?JWTTOken) with JWT token as query string.
Now i have created webview Navigating event to check whether the navigation is taking place in my webView.When i debug the webview Navigating event then it is working till the redirect_uri page is called and not working when it is getting redirected from the redirect_uri page.
Please help me in finding the solution.

Build web page request in Objective C

I'm building a native application. The app has an embedded webview (UIWebView) pointing to a social website. To be able to use the website inside the app, user has to log in by the webview (username/password) and then he can continue use the site with saved cookies. Normally, the cookies expire after two days. After that, the user has to re-login by the webview.
Now suppose I know username and password of the user and I would like to make the user login automatically with this account when the cookie expires. How can I do that?
I tried to simulate the Login action when I click on Login button on web page, but not successful.By using "Inspect Element" of Chrome, I can see Chrome makes a "Post" request to an URL with some parameters. However, the request doesn't get successful (I use REST client for testing).
Finally I found out the solution. I didn't build requests anymore. I used javascript to set text fields and make "click" action on the webview. Done.

browsing inside an iframe

I have a wordpress page that loads an
iframe prompting the user to navigate through bing to a webpage he/she wants. After browsing and upon arriving at the page the user wants he/she has to press a button to copy the current ulr to the clipboard or to print the url through alert() or on screen.
Question: is there a status attribute or something else that can give me the current status / metadata of the iframe (i.e. what page the iframe is visiting at a specific moment?). Thank you very much!
You cannot, it is forbidden to access any contents of an iframe that is not from your own domain, this is because of cross-site scripting restrictions.
You can read more about that here:
http://en.wikipedia.org/wiki/Cross-site_scripting
If you would be on the same domain however, you could do something like this in jQuery:
var url = document.frames['example-frame'].location.href;
when you would have an iframe like so:
<iframe name="example-frame" src="www.example.org"></iframe>

Safari on iPhone: Can I close the oauth browser tab?

I am using oauth to authenticate my iPhone-app's users. They click the login button and Safari opens to display the password entry page. Afterwards they are redirected using a custom url scheme, e.g. myapp://somethingsomething, which opens the application again (sending Safari into the background).
Can I close the browser tap during that redirect? Or directly afterwards via Javascript?
I ask because if my user imports a bording pass to his Passbook, Safari opens and logs my user in again, since the tab was still there.
Ok fixed by doing a setTimeout() call in JS before issuing the redirect. In the setTimeout() another redirect is executed: To a harmless page.

logout does not work properly in struts2

i am developing a struts project.
In login page action stored username and password in session.
In logout action class using session.invalid and removed that session details and redirected to index page.
But i click back button in browser it goes to the previous page.
Now i need sample code for if i am clicking back button after logging out it will show the error message or it display index page like yahoo mail.
need sample for that in struts2
As I know, very hard to do JS side. because back button belong to web browser. Our project do below way:
When logout, close currently window and open new window. that will help you clear history.

Resources