I want to add a login button to my bot so users can log in and I can store and extract a unique id (that I provide) for that user that I can use later to grab specific information. I'm having trouble following Facebook's documentation for this.
Right now I have generated a login button that when pressed links to my login page via an external pop up browser but right now when logged in, the page just redirects to my website. I also noticed that the URL that is popped up provides an account linking token but i'm not really sure what to do with this.
Do I have to write some code on my end to work with this interface or am I missing something? Also how can I get it so that the external browser closes after a user logs in.
Yes you have to write some code on your end to create a page and backend code that can:
1) Lookup PSID on FB Graph (Optional)
2) Do other account stuff (Optional)
3) Use redirect_uri to send the user back into the bot
The user has to click 'done' after Facebook shows the 'account linking successful' window.
Related
I'm working with javascript and i've made a site for only one person (admin), who needs to log in to Facebook and then the script extracts data from many public pages on facebook through some ids i've saved in a local database.
What i'd like to do now is actually the same, but without user interaction. This means the admin shouldn't log in his facebook account to start viewing facebook pages stats.
Is there anyway to code making use of a token (I've read that you can make them permanent) and instead of logging in to facebook in your welcome page, just start watching pages stats? Is there anyway to just skip the log in pop up from Facebook?
My project team and I are currently working on a Single Web Application project using Java Spark in the back-end and Javascript, HTML and CSS (with Bootstrap) in the front-end. We use MySQL as our DBMS.
We're trying to make a system to log a user on Reddit in to our site. We need Reddit to get a user's karma and not manage passwords and usernames ourselves.
We're using Reddit's OAuth API in order to ask for a token, and Reddit then redirects the user to our website again.
We've made a button on our website to log the user in.
What we're trying to achieve is:
The user clicks the log-in button.
The user gets redirected to the Reddit login page and needs to give permission to us to use their Reddit account with a few permissions.
The user accepts the request and then gets redirected to our website. The Reddit API sends a GET request to localhost/login and appends the state and Reddit token to the link (so the link becomes localhost/login?state=STATECODE&code=REDDITTOKEN).
In the back-end (Spark/Java), we catch that GET-request and extract the state and code. We then send the code to Reddit to get a JSON with the user's data (such as comment karma, link karma and username) using https://oauth.reddit.com/api/v1/me.
The back-end then checks if the username is already in our User table. If it is, the user already registered, and the user gets redirected to the mainpage and gets logged in. (We do log-ins by assigning session IDs to users in out User table.)
If, however, the usernameis not yet in our database, then the user gets redirected to the registration page/section of our website, and in some way, the username and karma-values are passed to this page.
The user then fills in the remaining details about their account (email, address, age, etc.) and then clicks on register. This then sends a POST-request to our server with all the details (username, comment karma, link karma, email, address, age, etc.) and puts that user in our Database. The user then gets logged into our website and gets redirected to our website.
The problems we are facing right now is
we don't know how we can pass the username, comment karma and link karma from our back-end to our front-end. We thought doing it with a cookie would do the trick, but this causes security-issues and just makes it more confusing for us.
Maybe there is a better way to handle this system. We would really appreciate suggestion for doing this in a better manner than this way. However, we have to deliver something working by Nov 10th.
Is there a way to pass values from Spark/Java to a webpage when registering someone?
I can share some bits of our code if wanted. Right now, our GitHub repository is private, however.
Your help is extremely appreciated. I might even buy you coffee.
Sincerely,
Jeroen Meijer.
i have a project that have option to log in with facebook.
but this option only work for the admin of the site
whenever any other user want to log in the site a form will appear and ask some info. if full fill the form and click register it shows a error message.
Now i want to remove the form part from the website and want onclick login for all user. here is the link of the site
https://dev.metarank.com/
please help me to find the solution
thanks in advance
If I am not wrong to create a Facebook login button you need to create an app to obtain api keys, right?
If it is the case the problem could be the following:
After testing the login button you have to make the app publicly available by passing a review process from Facebook, and then anyone will be able to login to your website with a Facebook account.
As said: this is the process for standard apps, at the moment I am not sure at all about if it is exactly the same process for logins.
I'm making the Facebook app whit JavaScript SDK, and I need user likes permissions to make a like gate. When I go to my app for the first time I get the popup whit permissions and big red alert: "The following permissions have not been approved for use and are not being shown to people using your app: user_likes " When I submit my permissions for approvement they reject me... Is there another way to make a like gate?
If you're having a Page Tab App, then use the signed_request data. If not then you'll need the permission to be able to access the User's likes.
Have a look at my answer here: perl Facebook::Graph API check if user likes page
I have read Facebook documentation and it says that FB.logout is used to log the user out of both web application and Facebook. I have made a website on which I use FB.logout() but I want only the session of the user to be revoked not log the user out of the Faceboook.
I have seen this thing been done on many other websites looking at their code I find they are also using code like
function fb_logout(){
FB.logout(function(response) {
console.log('loggedout');
});
}
I also tried using this function but I still log my users out of Facebook too.
Is there a way to accomplish this task?
You can just delete all the data you have on user and show them login button again (mimicking logout from your app) without calling "FB.logout" function(it logs user out of facebook too). This will behave as per your needs, once user clicks on the login button again, you will again get the data without him needing to login to facebook again.