Facebook login (xcode8) Swift3 Not working - fbloginview

I try every solution from internet for this problem .
I use : Version 8.0 beta 6 (8S201h) Swift 3
I setup :
Info.plist from facebook dev site with current app data ,
AppDelegate ,
Put FBlogin btn (also try custom FB login btn) ,
import FB SDK (last) ,
Single Sign On YES - facebook dev
set localhost for App domain
I add also web login component (in ios ap i put webview), to try alternative solution . Not working...
Please go to repo :
this is the link of project :
https://github.com/zlatnaspirala/FBLoginSwift3
I post this question on facebook dev help page and they tell me to
turn on KayChain Sharing . This help me to move from dead point.
I have some success with fbsdkloginmanager with popup login windows.
After entering email and pass in popup app show -already authorized ...
I press confirm i got my user name , friends (logged in )etc.
But this login.loginBehavior = FBSDKLoginBehavior.native and native button (delegate) not woking ..
New error log :
-canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"
screenshoot1 :
This is working code but works slow also error log and popup(screenshoot1) are still here :
var login = FBSDKLoginManager()
// login.loginBehavior = FBSDKLoginBehavior.native
login.loginBehavior = FBSDKLoginBehavior.web
// login.logOut()
login.logIn(withReadPermissions: ["public_profile", "email", "user_friends"], from: self ) {
(loginResult: FBSDKLoginManagerLoginResult?, error: Error?) in
if (error != nil) {
print("Process error2")
}
else if (loginResult?.isCancelled)! {
print("Cancelled2")
}
else {
print("Logged in2")
self.showUserData()
}
}

Related

Not able to fetch twitter user email id using react-native-twitter-signin

Trying to build twitter login using "react-native-twitter-signin": "^1.1.1" few days before it is working fine but now in android version it only return error Error: { NativeMap: {"email":"COULD_NOT_FETCH",... and in IOS email is null. below is my code snippet
_twitterSignIn = () => { RNTwitterSignIn.init(Constants.TWITTER_COMSUMER_KEY, Constants.TWITTER_CONSUMER_SECRET) RNTwitterSignIn.logIn() .then(loginData => { console.log(loginData)
if (loginData.authToken && loginData.authTokenSecret) {
var user = {}
user.social_type = 'twitter'
user.social_id = loginData.userID
user.email = loginData.email
user.name = loginData.name + " " + loginData.name
/// this._social_login(user)// after getting data perform action
}
}).catch(error => {
console.log(error)})}
Please help
so did anyone get any solution ?can anyone figure it out that it is library problem or twitter developer cosole settings problem? Though somany time I cross checked the developer console which is perfectly configured describe in doc. means for Email id fetching 'Request email from users' is on and also privacy & terms service urls are present. So any solution is highly appriciated. thank you

Facebook login api still gives the error of https required even if app is in dev mode

I created a test app on facebook and set the domain and the site url to localhost and http://localhost:4200 respectively.
The app is in development mode, as the documentation says "You will still be able to use HTTP with “localhost” addresses, but only while your app is still in development mode", nevertheless I get the error "The method FB.login will soon stop working when called from http pages. Please update your site to use https for Facebook Login." when I invoke the FB.login() api.
Sometimes the facebook window to log the user is not displayed , other times the window opens with the error "Login Error: There is an error in logging you into this application. Please try again later." within.
Update
I'm over https in locale and the relative error is disappeared.
This is the function invoked by the "Login with Facebook" button
loginWithFacebook() {
this.btnLoaderFB = true;
this.auth.facebookInitializer()
.then(() => {
this.auth.facebookInitialized = true;
return this.auth.facebookLoginStatus();
})
.then((loginStatusResponse) => {
console.log(loginStatusResponse);
if (loginStatusResponse.status !== 'connected') {
return this.auth.facebookLogin();
} else {
return this.auth.getFacebookProfileInfo();
}
})
.then((profileInfo) => {
console.log(profileInfo);
this.auth.loginWithFacebookRemote(profileInfo)
.subscribe(
res => {
this.btnLoaderFB = false;
}
);
})
.catch(err => {
console.log(err);
this.translate.get('t.validation.error_fb_login').pipe(takeUntil(this.unsubscribe)).subscribe(
t => {
this.error = t;
this.btnLoaderFB = false;
});
});
The first time I call this function I receive the response from facebookLoginStatus() logged on the console
I enter the fb credential and I get this error
If I try to click again on the button I receive the same response from facebookLoginStatus() I showed in the first image and the facebook popup window shows the same error message in the previous image.
If I reload the page the facebookLoginStatus() response is what I expect for a logged user on facebook and the login process ends without error
I can recommend using https even on localhost, especially because you will have a system for testing that is more similar to the live environment. This solves the Facebook https issue once and for all.
For Node.js, it is very easy with this tool: https://github.com/davewasmer/devcert
For PHP, you may want to take a look at this thread: How do I allow HTTPS for Apache on localhost?
For Angular CLI: Get angular-cli to ng serve over HTTPS

How to login with HTTP basic authentication to ACCESS the website- Test Cafe with Gherkin and cucumber

All links, project name and company name has been modified and are not original.
We have a basic HTTP authentication popup that appears when we are accessing out test/staging environments.
I am wondering, how can I enter the login information into the popup login window or send an api request in advance to save the cookie?
Because otherwise, I can't run the automation on our test environment. When the test access the page, I see a white website showing "unauthorized" in small letters.
This is what the login prompt looks like when accessing the Test/Staging env
We are using following plugin: https://www.npmjs.com/package/gherkin-testcafe
What I am asking is very similar to this question: Testing http basic authentication with Cucumber and RSpec in Rails 3.2.3
I have tried adding a role and using TestCafe http-authentication.html
Here is what I have tested so far:
TestCafe trying to use role:
const { Role } = require('testcafe');
const regularAccUser = Role('https://website/login', async t => {
await t
.typeText('#login', 'username')
.typeText('#password', 'password')
.click('#sign-in');
});
Given("I am open Dealer's login page", async t => {
await t
.useRole(regularAccUser)
.navigateTo(`${url}/login`);
});
That gives me:
ERROR CompositeParserException: Parser errors:
(7:3): expected: #EOF, #Comment, #BackgroundLine, #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Empty, got 'Correct action happens when user provide either wrong or correct login information'
at Function.Errors.CompositeParserException.create (/Users/dennis/Projects/src/company/project/node_modules/gherkin/lib/gherkin/errors.js:27:13)
at Parser.parse (/Users/dennis/Projects/src/company/project/node_modules/gherkin/lib/gherkin/parser.js:72:45)
at specFiles.forEach.specFile (/Users/dennis/Projects/src/company/project/node_modules/gherkin-testcafe/src/compiler.js:43:33)
at Array.forEach (<anonymous>)
at GherkinTestcafeCompiler.getTests (/Users/dennis/Projects/src/company/project/node_modules/gherkin-testcafe/src/compiler.js:42:20)
at getTests (/Users/dennis/Projects/src/company/project/node_modules/testcafe/src/runner/bootstrapper.js:79:47)
at Generator.next (<anonymous>)
at step (/Users/dennis/Projects/src/company/project/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /Users/dennis/Projects/src/company/project/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
If I try using:
import {Role} from 'testcafe'
I get:
tests/ui/stepDefinitions/login/login.js:1
(function (exports, require, module, __filename, __dirname) { import { Role } from 'testcafe';
^
SyntaxError: Unexpected token {
Using TestCafe's HTTP Authentication:
Feature: Login with correct and wrong info functionallity
.page('website/login')
.httpAuth({
username: 'username',
password: 'password',
})
Correct action happens when user provide either wrong or correct login information
#loginFunc
Scenario: Should NOT be able to login without filling in any credentials
Given I am open Dealer's login page
When I am login in with "empty" and "empty"
Then I should NOT be able to press the login button
I am getting following:
Feature: Login with correct and wrong info functionallity
✖ Scenario: Should NOT be able to login without filling in any credentials
1) Cannot obtain information about the node because the specified selector does not match any node in the DOM tree.
  | Selector('button[data-qa="qa-login-submit-button"]')
 > | Selector('button[data-qa="qa-login-submit-button"]')
Browser: Chrome 72.0.3626 / Mac OS X 10.14.3
32 | }
33 |});
34 |
35 |Then("I should NOT be able to press the login button", async t => {
36 | await t
> 37 | .expect(submitButton.hasAttribute('disabled')).ok()
38 | .expect(h1.exists).eql(true);
39 |});
```
It is basically showing me a white screen and saying: "**unauthorized**" in small letters.
You don't need any post/get requests with the Basic HTTP. Instead, you can log in using the Role mechanism:
When you switch to a role for the first time, TestCafe internally creates a branch of this role for this particular test run. All cookies set by your further actions will be appended to this branch. This branch will be used whenever you switch back to this role from the same test run.

Fetching list of user's friends for website

I have implemented Fb login for my website. Also for the Fb page of my app inside approved items it shows - user_friends
Provides access to a person's list of friends that also use your app. This permission is approved by default.
How can I get the list of friends of the user who is there on my app ?
Also When I try to do this --
FB.api(
"/me/friends",
function (response) {
if (response && response.data){
alert(response.data);
} else {
console.log('Something goes wrong', response);
}
}
);
I get no response.
Thanks,
Newbie
First, you need to include and initialize the JavaScript SDK: https://developers.facebook.com/docs/javascript/quickstart/v2.2
Then, you need to authorize the user: https://developers.facebook.com/docs/reference/javascript/FB.login/v2.0
(don´t forget to use the scope parameter with the "user_friends" permission)
After that, you can call FB.api('/me/friends'... to get the friends of the user who authorized the App too.
You can also test /me/friends in the API Explorer, just select the correct App: https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Ffriends&version=v2.2

API Error Code: 191 occurs only in Page Tab application

I've this error only when the app is in the page tab:
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.
In page tab http://www.facebook.com/pages/ConMar/268459383261877?sk=app_148000545338378 if you click on "Invita Amici" you see the error.
But with the App in facebbok I don't have the problem, it works fine: http://apps.facebook.com/family-and-friends/
Both "URL canvas:" and "Page Tab URL:" ar set to: "http://www.d4v1d3.com/family-friends/"
I use the example code:
FB.init({
appId : 'xxxxxxxxxx',
frictionlessRequests: true
});
function sendRequestViaMultiFriendSelector() {
FB.ui({method: 'apprequests',
message: 'My Great Request'
}, requestCallback);
}
Do you know why I' ve the error just in the case of page tab?
Thanks.
Go to your app settings and make the additional configuration under Basic Settings.
If your domain is http://inspiration.nyp.edu.sg
If you are working on localhost
You can refer to Sending msg and post on own wall function no longer work for more information.