Facebook login : Make email mandatory

We are using facebook for login in our website.
We need email as a mandatory permission. If the user doesn't grant email permission then the dialog should give an alert() message saying 'Please grant email permission' and repeat.

I have seen this feature in few of the shopping sites. The below code works fine but doesn't have the feature I mentioned.
Help needed.

window.fbAsyncInit = function () { FB.init({ appId: 'MY APP ID', oauth: true, status: false, // check login status cookie: true, // enable cookies to allow the server to access the session xfbml: true // parse XFBML }); }; function fb_login() { FB.login(function (response) { if (response.authResponse) { access_token = response.authResponse.accessToken; //get access token user_id = response.authResponse.userID; //get FB UID FB.api('/me', function (response) { // you can store this data into your database alert(response.email); }); } }, { scope: 'email' }); } (function () { var e = document.createElement('script'); e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); } ());

Somewhere in the body of HTML.

<div class="span"><a onclick="fb_login();"><img src="css/images/facebook.png" alt=""/><sm>Sign In with Facebook</sm><div class="clear"></div></a></div>

-------------Problems Reply------------

Have a look at

  • https://developers.facebook.com/docs/facebook-login/permissions/v2.3#checking
  • https://developers.facebook.com/docs/facebook-login/login-flow-for-web#re-asking-declined-permissions

especially the "Handling Missing Permissions" part of the first link.

When an app requests permissions, people may completely deny those permissions, not fully grant those permissions, or change them later. In order to provide a great experience, apps should be built to handle these situations.

  • First, apps should be able to handle any permissions that were requested but not granted:
  • Check granted permissions before trying to use APIs that require them. Detect permissions errors returned when an API request is made without the correct permission.
Category:javascript Views:0 Time:2018-12-05

Related post

  • Get user basic information using facebook Login button plugin? 2011-08-20

    Here I am using Facebook Login button plugin and javascript sdk I am able to successfully login and logout by using above. When a first time user has gone through authentication process I need to store user basic information i.e. Facebook login name,

  • How to make UITextView look like Facebook login? 2010-05-05

    How can I make my textfields look like the Facebook login screen? --------------Solutions------------- That's really a UITableView. You can put some UITextFields without a border inside a couple of UITableViewCells. I'm extremely late to the party -

  • How can get email adress through facebook login? 2011-09-21

    I have integrated facebook login into my site(codeigniter).How got name,prifile url etc ..but email adress is null...How can i get email address? I used code from http://www.haughin.com/code/facebook/ --------------Solutions------------- Make your ap

  • how to ask permissions for email again if its permission is denied in authoriztion on facebook login into iOS app 2014-09-19

    In my app,there is facebook login am creating custom ui for facebook login.I am fetching users public profile and email.On first time logining in with facebook there is an authorization screen shown as shown in 1.jpg.In this screen there is a option

  • YQL + PHP : how to make a facebook login 2010-12-23

    I was reading some stuff about the YQL api that Yahoo! has provided, I am not sure, but it appears to be a collection of lots of third party api into one common language, right? what I don't get is how to make the facebook login through it so I can g

  • Facebook Login : How do I get the users email? 2011-06-19

    I'm new to the facebook api, but I have this: <html> <head> <title>My Facebook Login Page</title> </head> <body> <div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js">

  • Retrieve Email Id from FaceBook Login in vb.net application 2011-09-30

    I want to integrate Facebook with my .net application which is in vb. I want to use facebook login as open id login to my application. I reached to login with fb and get all basic information of my facebook profile. But still I do not get facebook lo

  • Can I get a login user Email using Android Facebook Graph-API 2011-10-20

    I want to get a email of facebook login User but I am not success still to now. Can anybody help me that it is possible using a Facebook_Android API or not? explain with code if answer yes. --------------Solutions------------- Check this post for get

  • How to make facebook like button shows a mobile-optimized Facebook login page? 2011-09-15

    I have a mobile website designed to be shown in a iPhone app. There is a Facebook like button in that mobile web. If the user click the like button without logging in, the button will show a full-facebook login page, which looks like a disaster in mo

  • After facebook login how to get User Information using javascript SDK in asp.net application 2010-06-25

    I have to implement facebook login and also want to get logged in user's information like birthday, firstname, Email address. I have already done some other stuff like recent activities etc of facebook using javascript SDK of facebook. i am developin

  • Facebook login within Flash without popup or redirect? 2010-07-14

    Does anybody know how to handle a Facebook login from within Flash using REST API/FB Connect, without the popup or redirect? It doesnt seem very possible as the login method seems to force the popup. Might it be possible by modding the code to have i

  • What are the post parameters i need to pass to the facebook login page? 2010-08-10

    What are the post parameters i need to pass to the facebook login page? --------------Solutions------------- I'm assuming they want to something shady... to login to facebook via http requests you can do this: make a post request to this url: https:/

  • Facebook login programatically using OAuth/XAuth(?) 2010-09-28

    I am making an app that needs to be able to share stories to Facebook, using a password and email-address that was set somewhere programmatically (not using Facebook-Connect, mostly because I want my own design, whether you log in to Twitter or Faceb

  • Facebook Login on your site - Help 2010-11-16

    I have a fully functioning website with user accounts/profiles and admin area. I would like to integrate the Facebook login to my website. I have added the Facebook php sdk to my server. I now have (well, sort of) the Facebook login working on my web

  • facebook login button not rendering 2010-12-31

    Hi I am developing a widget that will be placed on an external website. The entire plugin has to be written in javascript. I haev searched here and there but am unable to make the facebook login button appear on the widget My code is the following va

  • Instant login from email. Why have so few done this? 2011-01-11

    Tried searching for this but turned up nothing. Discussion or relevant links are requested. Suppose we are going to send an email to entice a user to login to our super social webapp. The goal of this email is to get them to return to the site and po

  • Facebook login image in server side implementation 2011-02-16

    I suspect that there's a simple answer to this, but since I'm stumped, let me throw this out there. I am implementing a "Login with Facebook" feature for a website. Facebook allows ways to do most of the work either on the server or the client side.

  • Facebook login callback hash documentation 2011-03-02

    I'm using Omniauth with Devise to authenticate users via Facebook for a web app I'm writing using Rails 3.0.4 I modeled it after Ryan Bates' Railscasts: http://railscasts.com/episodes/235-omniauth-part-1 http://railscasts.com/episodes/236-omniauth-pa

  • Facebook login button disappears if I refresh the page in IE 9 2011-07-11

    Facebook login button disappears whenever I refresh the page in Internet Explorer 9. All other browsers are OK. IE only shows the button first time any refresh make it disappear. I am using facebook connect with folowing code <script type="text/ja

  • Facebook login-button no longer appears after login then logout 2011-09-04

    My facebook login-button has been working great: <fb:login-button length="long" background="light" perms="email" size="medium" onlogin="myLoginCode()"></fb:login-button> After a user logs in, that facebook login button disappears. On my l

  • Integrating facebook login with omniauth on rails 2011-09-09

    I am using Railscast Episode # 250 to implement authentication from scratch. However, now I want to implement Facebook login. From googling I've found that OmniAuth and Devise are the prime contenders to do this in Rails However, this example page is

  • Facebook Login Button - how does it work? 2011-11-16

    I've been reading this Facebook Dev guide on Authentication And i'm wondering how exactly does the xfbml based login button works to the point where a cookie with the user's access_token is planted in the context of your web application's domain. I f

  • Facebook login button with oauth 2 not calling auth.login 2011-12-16

    Our Asp.net site has been using the facebook login button (w/ javascript sdk) to handle the login process, and now that Oauth is mandatory (as of Dec 15, 2011 (yesterday))- it is broken. I've made some obvious changes that were mentioned the fb oauth

  • iOS Facebook Login but not Connect? 2012-02-15

    today I've an hard question that it causes me some problems. I'm beginning to implement, for the first in my life, the Facebook Login/Connect in my iOS application. What's strange? Nothing so far, except I want that the users can ONLY login in the ap

  • Facebook Login confusion 2012-02-17

    I am planning to integrate a Facebook Login button into my website. Right now I have a Facebook Login button that when pressed, popups a new window asking for permission to access the user's basic info and email. Everything done till now is from foll

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.721 (s). 12 q(s)