How to use Social-Auth-Django-App with Facebook's https://m.me/ - django

I tried using hyperlink and supplied it with my actual Facebook Username and it's working. But the problem is my actual Facebook Username is different from the Username provided by Social-Auth-App-Django. So I tried User ID instead but it's not working either.
By the way what I'm trying to do is an online shopping website and when a user clicks the hyperlink, he/she will be redirected to the seller's Facebook Messenger account to start a conversation.
This is the first line of code that I tried which is working.
Send Message to Seller
And this is the code I used using Social-Auth-App's provided data:
Send Message to Seller
And I also tried this:
Send Message to Seller
Any idea how I can use Facebook's m.me/ using the provided data by Social-Auth-App-Django? Or if you can suggest me other ways other than m.me/ I will greatly appreciate it. Thank you very much!

First Go To Setting.py And Put This Code End Of All Codes:
AUTHENTICATION_BACKENDS = [
'social_core.backends.facebook.FacebookOAuth2',
]
Second Go To FaceBook Developer In This Address :
https://developers.facebook.com
And Make One Account There.
After go To My Apps And Then Click On Create App And Then Put Your Website Name ((Attention...If You Use Your Local Host You Need To Put One Domain Name For Your Local Ip)) And Your Email And Click On Create App ID And In Your Dashboard Looking For Facebook Login And Click On Set Up .
And Then In First Step In Web Window Put Your WebSite Name For Local Host For Example Put mysite.com:8000/ And Click On Save And Other Options Just Cross .
Now In Your Dashboard On The Left Side Click On Setting And Then Basic If You See Your APP ID And Your APP SECRET Put This Two In Your Settings.py After That Last Code .
SOCIAL_AUTH_FACEBOOK_KEY = 'Put Your App Id Code Here'
SOCIAL_AUTH_FACEBOOK_SECRET = 'Put Your App Secret Code Here'
If You Want To Take User's Email Also You Can You This As Well .
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
Now In You Dashboard Go To Settings And After Go To Basic An In Field App Domains Put Your Website Name Also Go To Settings After Advanced And Put Website Name In Domain Manager With CLick On Add a Domain .
Now Again In Dashboar Go In Products+ Part And Click On Facrbook Login After Settings And Check These Option Be Active(Yes) :
• Client OAuth Login
• Web OAuth Login
• Enforce HTTPS
• Embedded Browser OAuth Login
And IN This Form Your Are Now Also Go In This Field Valid OAuth Redirect URIs And Put This URL :
exapmle.com/social-auth/complete/facebook/
And Put Your Button In Your Website Page That Have This Login Auth :
<li>
Sign in with Facebook
</li>

Related

How to show email prefilled in google oauth sign in form

I am using WSO2 as identity server and google authenticator as the identity provider. Login is working correctly. On my web application, I am asking the user to enter his email and then showing google login form. I want to show this email to be prefilled this form. Thanks.
You can do it. For that, you need to customize the OpenIDConnectAuthenticator.java to pass the login_hint to google.
Clone https://github.com/wso2-extensions/identity-outbound-auth-oidc.git.
It is recommended to checkout to the org.wso2.carbon.identity.application.authenticator.oidc version in your server(you can find it in IS_HOME/repository/components/dropins/)
Add these lines before response.sendRedirect(loginPage); in OpenIDConnectAuthenticator.java
String[] usernames = context.getAuthenticationRequest().getRequestQueryParam("username");
if (usernames != null && usernames.length > 0) {
loginPage = loginPage + "&login_hint=" + usernames[0];
}
These lines will get the username from the authentication initiation request and send it as login_hint to google.
Build the component using the following command.
mvn clean install
This will create org.wso2.carbon.identity.application.authenticator.oidc-5.1.17.jar in target folder.
Replace the existing org.wso2.carbon.identity.application.authenticator.oidc-.jar in the IS_HOME/repository/components/dropins folder.
Restart the IS server
When sending authentication request to IS append username=senthalank#gmail.com as url param
For example,
https://localhost:9443/oauth2/authorize?response_type=code&client_id=<cliend_id>&redirect_uri=http://localhost:8080/playground2/oauth2client&scope=openid&username=senthalank#gmail.com

cannot get previous page name on device using ionic2

I am using ionic 2.
I update my ionic version.
Ionic version 3.4.0
If user not authenticated my root page is Login Page. after user logged in and go to dashboard Page.user When click on hardware back button go to Login Page.
I Need if user authenticated click on hardware back button does not go to Login page.Display msg "Do you want to exit?"
Because I need get previous page name.
I used this Code
this.navCtrl.last();
It's work fine on browser.But not work on device.
I run my app.
I consoled the value
t {_isHidden: false, willEnter: e, didEnter: e, willLeave: e, didLeave: e…}
and its return the page name is 't'.
Then you can pass the name of the current page while you route to a new page. Then you can use that name from new page.
Example (Assume we are routing from page A to page B)
in page A
this.navCtrl.push(B,{previousPage:'A'});
in page B
class B{
constructor(private navParams: NavParams) {
let previousPage= navParams.get('previousPage');
}
}
====UPDATE=======
I cant understand why you want previous page name for achieve this. any way your requirement can achieve as following.
in your app component set root page as loginPage.
public rootPage: any = LoginPage;
Then, If user login success. route to dashboard page by calling
navCtrl.setRoot(HomePage); // here user will route to the home page and set it as root
You can re change the root page as login page when user click sign out
navCtrl.setRoot(LoginPage);
then if user is authenticated root page will be HomePage and if user click back button user will leave the app.
Hope this will help you :) enjoy Ionic ;)

Facebook access token is taking user_photos permission only for developer account

I want to get the albums from the Facebook in my app. I'm requesting the accessToken with email,user_about_me,user_photos permissions. While authenticating with the Facebook account in the pop window it is written as "app will receive the following info: your public profile, email address, photos and personal description.", this message is coming only for the developer account .
If I login through another account the pop up window text will be like this "app will receive the following info: your public profile and email address. ", there is no photos permission is coming in this message, as a result my accesstToken doesn't getting the albums of the user.
I made the app live for the public. I'm working on grails framework in groovy language
private static final String AUTH_URL = "https://www.facebook.com/dialog/oauth"
static def getLoginUrl() {
def params = [
response_type: "code",
client_id : CLIENT_ID,
redirect_uri : REDIRECT_URI,
scope : "email,user_about_me,user_photos"
]
def url = "$AUTH_URL?" + params.collect { k, v -> "$k=$v" }.join('&')
return url
}
EDIT: I just now created a new app in another facebook developer account and I used those credentials in my app. Then my app is getting albums from that devloper account only. It seems that it is working with the developer account. I checked all options age is anyone(13) , country option is also disabled.
Read about "Login Review" in the docs: https://developers.facebook.com/docs/facebook-login/review
Most permissions only work for users with a role in the App by default, you have to go through a review process with those.

Retrieve all basic information using FB Graph API

i'm currently using the following api of FB Login integration in my Mobile Website : FB.api('/me', function(response){...} . In the resposnse i am only getting an id field and a name field. Is there any way where i can retrieve the actual email of the user who logs on to the site using FB Login pop up.
I read in the documentations about another URL /{id} , but it also returns only id and name.
Please suggest
To get the email of a user, you have to autorize the user with the email permission, and you have to add the field parameter to the API call:
FB.api('/me?fields=name,email', function(response){...}
or:
FB.api('/me', {fields: 'name,email'}, function(response){...}
Check out the changelog, about "Declarative Fields": https://developers.facebook.com/docs/apps/changelog#v2_4

FB.api doesn't bring profile name

I am using Facebook JS sdk to show news feeds. the app works well for many users for for some users who have authorized my app doesn't bring reasonable result.
I use following code to get basic profile info which works for some users but for some it doesn't:
FB.api('/' + id + '?access_token=' + access_token, function (response) {
var strTitle = response['first_name'] + " " + response['last_name'];
});
In response object I receive only id, birth date, email, profile link but name is not available. Interestingly when I open profile link in my browser facebook says:
"Sorry, this page isn't available
The link you followed may be broken, or the page may have been removed."
after that my code can bring its posts but again the from name of the posts is missing in response object. The permissions list is attached as picture.
I can't understand what is going on and how can i fix this issue. Any help please?
The problem is that you are using the App center permissions feature (previously known for Authenticated referrals).
Use these settings to enter the set of permissions your app requires when displayed in App Center
You should be passing a login url with the scope array of permissions in JS SDK.
FB.login(function(response) {
// handle the response
}, {scope: 'email,user_likes'});
or via a login button
<div class="fb-login-button" scope="email,user_likes" data-show-faces="true" data-max-rows="3">Login with Facebook</div