Oracle-Apex: Dynamically redirecting from login button - oracle-apex

The scenario
I have implemented social authentication similarly to described by Dimitri Gielisin hist post "Facebook, Google and Custom Authentication in the same Oracle APEX 18.1 app" (http://dgielis.blogspot.com/2018/06/facebook-google-and-custom.html)
The pertinent point is that there is a button which has the request 'APEX_AUTHENICATION=FACEBOOK' which logs the user in and also hard codes the page that the user is taken to.
It works great. (However if I have a login menu item which directs back to the same page - the user name isn't updated on the page.)
The Issue
Default behaviour is for apex to redirect users to the login page when they attempt to access a page which is not publicly available.  After logging in the user is taken to the page hard coded page in the button (except for modal dialogues which just produce an invalid session error). 
I'd love it if they could sign in and then continue to the page they need to go to. Is there some not extremely cumbersome ways of doing that? I thought of trying to saving the page number I want the user to go to into an application item and then having the button redirecting based on the application item- but while I was saving the page number the dynamic redirect in the button is not working...and I feel like I'm fighting the apex framework...
Is there a better way? If not can a button reference an item for the page number? I was trying &APP_ITEM. but that didn't seem to work...
(I"m using Apex 20.1)

Related

The admin option doesn't show up next to my like button

I have a problem. I created an app in FB and then with that app I created a like button. FB says that I should see an admin link next to my like button on my website when I am logged in.
I have fb:app_id and fb:admins set up in meta, still I don'see the link. I would need it for two reason.
One is to acces the admin of the page so I can send messages for people who liked my site, also I want to set up a fanpage and once I could access the admin of the website likes according to the facebook documentation I could turn it into a fan page (FB page) this way not loosing the likes.
Thanks in advance
That functionality is deprecated, there's a migration guide on Facebook's developer site explaining how to move your OG pages to regular pages if you want to maintain part of that functionality

Which access_token do I use to upload a video to an iframe based page-tab application?

I want to let users upload a video to a page that I am admin for. And the application has been added as a tab to this particular page.
Using the example from https://developers.facebook.com/blog/post/515/ resulted in an infinite loop where the page was reloaded every 2 seconds, and no auth_dialog was presented either. Could it be due to the fact that I am page admin?
So this application won't be posting anything to the users wall; it will only use the user_id and liked status of the page.
Which access_token should I use,
Ask the user to authorize the app?
Use the access_token that was created when the application was added to the page? Will this token never expire?

Facebook iframe app. it is possible refresh when user log out from other browser tab

I have an iframe application.
When a user and another page and log in to facebook site, the application page is reloaded by facebook.
But, I want to reload the page in the logout state also.
Here is the scenario:
A user enters my iframe application and authorizes my app and successfully enters my app.
While using my app, the user opens my app (or fb site) in another browser tab.
The user logs out from facebook site in the last browser tab.
When user logs out from facebook, I want to automatically reload my application page in the browser.
How can I do this?
Have a look at FB.Event.subscribe, I think you should be able to use it to reload the page when the user's session changes.
Add something like this to your FB.init:
FB.Event.subscribe("auth.sessionChange", handleSessionChange);
...and the handleSessionChange callback function would look something like this:
function handleSessionChange(response) {
if(!response.session || response.session.uid!="$user_id"){
window.location.reload();
}
}
Unfortunately, your options are limited as communication with an IFRAME is very constrained. This may help you:
http://www.dyn-web.com/tutorials/iframes/refs.php

How can I allow my users, who create pages on my website, to communicate back to those people who click the Facebook "Like" button on their pages?

OK, apologies for the verbose title. Let me give the background in a bit more detail.
My website allows my registered users to create new pages, each of which has its own unique URL. Each page has a Facebook "Like" button on it. I've already implemented Facebook Open Graph API meta tags so that the pages are proper open graph objects, and when some other visiting Facebook user "likes" the registered user's page, a post appears on that Facebook user's wall saying they have liked the page. The Facebook Like widget also displays the number of "likes" that page has received as normal. So far, so good.
What I want to do is allow my registered users to be able to communicate back to the Facebook users who have liked their page. The community of "likers" for a page is a potentially valuable social media resource to the registered user, if only they could communicate back.
I am aware of the "admin page" link you get beside the Like button, which can be used to post to these people, but that is not an option for my registered users as they have no privileges in relation to the Like button.
What I want to do, if possible, is setup a form to capture the registered user's message back to the Facebook users, and then my website sends the message on their behalf, without having to ask for any extra privileges from the Facebook users.
The following Facebook documentation pages seem to say this is possible, but having followed the Open Graph API documentation, I can't get it to work as described - http://developers.facebook.com/blog/post/465/ and http://developers.facebook.com/docs/reference/api/ ("Publishing" subsection). I can get the access token correctly in the first request, and plug that into the second request to do the post, but that doesn't seem to do anything and doesn't return any error.
Since it doesn't work for me, I'm wondering if this is possible as described, or do I need to get some sort of extra permission to do this? I've seen reference to offline_access permission but as I'm new to this stuff I am not sure how it would fit in. If I have to get the Facebook users to grant permissions, this is not going to work as envisaged.
Any thoughts would be most helpful.
The short answer: No, You will never been able to post on someones wall as another user.
The long answer:
You could try to ask for offline access but then you are asking the user to hand over all their facebook data and give you access todo whatever you like their accound, so that is not likely to happend.
The next problem is that they have to be friends to be able to post on each others walls.
Thats why Pages was implemented, so that organisations could announce/talk with the people interested.
However if you have created the like button correctly and give the pages correct meta data, you are able to post to user who have liked it.
Scroll down to Publishing:
http://developers.facebook.com/docs/opengraph/
Just add a form for your user and let your system publish to the correct page, you probably will need a offline token from your own account or similar to use on the server.
Another more complex way could be to generate a facebook page for each page you have on your server.
When the user creates a page on your system a page is created on facebook but as your app as admin.
And when another user likes the page they like the facebook page, hence you have the possibility to post in that page and speak to the user who liked it. (whooa thats a mouthfull).

choosing right project template

i've a proect opening with user authentication page (asking username and password). There are some extra buttons here which the app navigate to a single page when the user clicks (up to that point there is no need for table view but from those sub screens app can navigte back to that main page). In addition, if user is authenticated then the app will navigate to a page which lists some items on it (table view) and then navigate to some detail views back and forward. And i also want my app to have core data support.
Navigation based or window-based are two major possibilities, aren't they?
thanks
It sounds like you are building a navigation based app. If you look at your app without the login page, it sounds like a textbook navigation based app. Generally a login page will be handled by just using presentModalViewController on top of your existing navigation controller.