PayPal API login error - "Sorry, we can't log you in.." - paypal

I am using the paypal api login with this:
paypal.use( ['login'], function (login) {
login.render ({
"appid":"myAppID",
"authend": "sandbox",
"scopes":"email",
"containerid":"lippButton",
"locale":"en-us",
"returnurl":"myReturnUrl"
});
});
when I click on lippButton paypal opens with forms for email and password. When they are filled in I get the error:
Sorry, we can't log you in. If you think there's a problem with your
account, contact us and we'll help resolve it.
Even though If I redirect the user to login/complete payment it is fine. Any ideas as to what the problem is?
EDIT:
Seems like it may just be the sandbox api is down. I went here:
https://devtools-paypal.com/guide/openid/php?success=true&env=sandbox
and clicked "Try it" then clicked on the link for step 2, which pops up an identical login form that I am using and the error message persists there as well.
EDIT:
Can anyone explain how I can log in to paypal, but not from their sandbox using my paypal credentials?

I found the problem. For anyone in the future with this same problem (I'm assuming many will because it is directly following their walk through), you seem to not be able to log in via "sandbox" mode (even though their provided code sample has authend: "sandbox" in it).
Simply put in your live credentials INSTEAD of your sandbox credentials. The log in should look like this (There should be no 'authend: "sandbox"' now):
paypal.use( ['login'], function (login) {
login.render ({
"appid":"myAppID", //Use your live client ID, not your sandbox client ID.
//No authend needed.
"scopes":"email",
"containerid":"lippButton",
"locale":"en-us",
"returnurl":"myReturnUrl"
});
});
And the login now works and allows you to login.

Related

Paypal login freeze (opencart 2.1.0.2)

I added the option to login with Paypal.
I am using the Paypal standard login.
I am using sandbox for testing but the issue persists even if in real mode.
Everything is ok except after the login with the email of paypal, after I input the credentials of paypal account it goes to load the setting from paypal account that I selected (name, date of birth etc,) it goes ok and after that it freezes in the same login window (a blank window).
In the site it does not do anything and doesn't login.
I noticed that the url in the login window goes to the redirect that I had to configure. I think that maybe it's related with the redirect URL. Can anyone please check if everything is ok with the settings or if it is a known bug with this?
The full url that appears in the login windows after the credencials are submitted is:
https://www.quitandabrasil.com/index.php?route=module/pp_login/login&scope=address+profile+email+phone&code=nhZpJ2YmnH_R3HXkheGFfPErrJluZ-fDhfDFuPgqLzwYX1AmNYNEfbjPiT5D-46YO-LaPWLQU98CVEoWO5ndUMfC1XGWOMg_yAJ6ZYCK_EpC1ns4Crl6A5bDV1DdAbrTbJlRthHtbpM1NAVBJpxskbViJjGhgdczvInmmSg8BCdEupPDJzKCb2j9RLoKZl8EEeD0pVBov2zRjrq2
I have uploaded pics of the opencart config "login with paypal" and from the developer site that have the sandbox account.
DGjlR.jpg
You can refer to https://github.com/opencart/opencart/issues/3640
Change the API URLs
//$endpoint = 'https://api.sandbox.paypal.com/v1/oauth2/token';
$endpoint = 'https://api.sandbox.paypal.com/v1/identity/openidconnect/tokenservice';
//$endpoint = 'https://api.paypal.com/v1/oauth2/token';
$endpoint = 'https://api.paypal.com/v1/identity/openidconnect/tokenservice';
Comment/remove line:
//CURLOPT_USERPWD => $this->config->get('pp_login_client_id') . ':' . $this->config->get('pp_login_secret'),

INVALID_RESOURCE_ID when Authorization.Capture is called on an authorized payment using sandbox account

I am using PayPal.1.6.0\lib\net45\PayPal.dll
I created a payment with authorize intent and have the successfully authorized authID (Payment.Cart) and the PayPal.APi.Payment.id.
When I try to call the Authorization.Capture(apiContext, Capture) with the authID, I get
{
"name":"INVALID_RESOURCE_ID",
"message":"The requested resource ID was not found",
"information_link":"https://developer.paypal.com/webapps/developer/docs/api/#INVALID_RESOURCE_ID",
"debug_id":"d73f6a0c1b8bc"
}
I tested this using my sandbox account.
Trying the link gets me a 'page not found error'. Any clues?
I realized that i was looking at the wrong 'authorization code'. It is not the ((Payment)executedPayment).cart as posted in my original question but ((Payment)executedPayment).transactions.FirstOrDefault().authorization.id
I was able to use the correct authCode and am able to capture my authorization. executedPayment is the return value from Payment.Execute method.

Can't login via Facebook iOS SDK 3 with a test user

Have a code that is working with ordinary FB user (login and post). Just created test user but unable to login. Getting message "we didn't recognize your email address or phone number". After calling https://graph.facebook.com/362652477144946/accounts/test-users?... I got:
{
"id": "100004233554579",
"access_token": "...",
"login_url": "https://www.facebook.com/platform/test_account_login.php?user_id=100004233554579&n=Ffaa4FVusNloYGS",
"email": "iosproject_gaxfjez_iosproject\u0040tfbnw.net",
"password": "..."
}
Tried entering "100004233554579", "Ffaa4FVusNloYGS" and "iosproject_gaxfjez_iosproject\u0040tfbnw.net" at username but nothing works. Any ideas?
UPDATE1 Noticed "\u0040" in email, so changed that to "#". But then getting "We didn't recognize your email" :)
UPDATE2 Noticed there's another email "100004233554579#facebook.com" when logged to Facebook login_url but it doesn't work too.
I faced the same problem with test facebook user login from mobile device - "we didn't recognize your email address or phone number".
What I did:
Went to dev console and created new test user
Clicked edit and changed password in console - than was a mistake
After you change password via dev console - facebook also changes test email. And you are able to login only at facebook.com website (not android, iOs or m.facebook.com) - because you get a security warning that email was changed. Also you can't use simple emails like qwerty.
What you need to do to get it work:
Create new test user in console (do not change anything)
Go to Graph API, generate application token, get test users via {app_id}/accounts/test-users (details)
POST new password (only password) to the test user /{user_id} (details)
Now you shall be able to login using m.facebook.com, Android or iOS apps
A little bit wierd
From your response, it seems like the email required for login should be
iosproject_gaxfjez_iosproject#tfbnw.net.
That should work for you with the password generated.
You can read more about creating test users here.
If it still doesn't solve your issue, please create a bug report at
http://developers.facebook.com/bugs and we'll be more than happy to look into it.

facebook url for open authentication login

First let me say I really sorry for asking a question about facebook.
I'm trying to use open authentication to login in users on my site but I cannot find where to register my application/website on facebook. What is the url?
update
I've done that but get this:
our account must be verified before you can take this action. Please verify your account by adding your <a onclick="var newwindow = window.open("http:\/\/www.facebook.com\/confirmphone.php",'confirm_phone', 'height=350, width=520, left=100, top=100, resizable=yes, scrollbars=no, toolbar=no, status=no');if (newwindow) { newwindow.focus();} else { alert("A pop-up blocker may be disabling the the mobile verification window.");}">mobile phone</a> or credit card.
update
If you get that link you need to paste this into the URL if it doesn't popup.
http://www.facebook.com/confirmphone.php",'confirm_phone&%23039;,%20&%23039;height=350,%20width=520,%20left=100,%20top=100,%20resizable=yes,%20scrollbars=no,%20toolbar=no,%20status=no&%23039;);if%20(newwindow)%20&%23123;%20newwindow.focus();&%23125;%20else%20&%23123;%20alert("A%20pop-up%20blocker%20may%20be%20disabling%20the%20the%20mobile%20verification%20window.");&%23125;
update
Then I have to join this group
http://apps.facebook.com/developer/
And when I do it says it's no longer there.
update
Ok finally got to a link somehow after register my phone.
http://developers.facebook.com/setup/
www.facebook.com/developers
Goto this URL and register your profile as a developer first. Then create a new application.
If you are able to do that successfully, then comment back for the further steps.

Facebook Oauth Logout

I have an application that integrates with Facebook using Oauth 2.
I can authorize with FB and query their REST and Graph APIs perfectly well, but when I authorize an active browser session is created with FB. I can then log-out of my application just fine, but the session with FB persists, so if anyone else uses the browser they will see the previous users FB account (unless the previous user manually logs out of FB also).
The steps I take to authorize are:
Call [LINK: graph.facebook.com/oauth/authorize?client_id...]
This step opens a Facebook login/connect window if the user's browser doesn't already have an active FB session. Once they log-in to facebook they redirect to my site with a code I can exchange for an oauth token.
Call [LINK: graph.facebook.com/oauth/access_token?client_id..] with the code from (1)
Now I have an Oauth Token, and the user's browser is logged into my site, and into FB.
I call a bunch of APIs to do stuff: i.e. [LINK: graph.facebook.com/me?access_token=..]
Lets say my user wants to log out of my site. The FB terms and conditions demand that I perform Single Sign Off, so when the user logs out of my site, they also are logged out of Facebook. There are arguments that this is a bit daft, but I'm happy to comply if there is any way of actually achieving that.
I have seen suggestions that:
A. I use the Javascript API to logout: FB.Connect.logout(). Well I tried using that, but it didn't work, and I'm not sure exactly how it could, as I don't use the Javascript API in any way on my site. The session isn't maintained or created by the Javascript API so I'm not sure how it's supposed to expire it either.
B. Use [LINK: facebook.com/logout.php]. This was suggested by an admin in the Facebook forums some time ago. The example given related to the old way of getting FB sessions (non-oauth) so I don't think I can apply it in my case.
C. Use the old REST api expireSession or revokeAuthorization. I tried both of these and while they do expire the Oauth token they don't invalidate the session that the browser is currently using so it has no effect, the user is not logged out of Facebook.
I'm really at a bit of a loose end, the Facebook documentation is patchy, ambiguous and pretty poor. The support on the forums is non-existant, at the moment I can't even log in to the facebook forum, and aside from that, their own FB Connect integration doesn't even work on the forum itself. Doesn't inspire much confidence.
Ta for any help you can offer.
Derek
ps. Had to change HTTPS to LINK, not enough karma to post links which is probably fair enough.
I was having the same problem. I also login using oauth (I am using RubyOnRails), but for logout, I do it with JavaScript using a link like this:
Logout
This first calls the onclick function and performs a logout on facebook, and then the normal /logout function of my site is called.
Though I would prefer a serverside solution as well, but at least it does what I want, it logs me out on both sites.
I am also quite new to the Facebook integration stuff and played around the first time with it, but my general feeling is that the documentation is pretty spread all over the place with lots of outdated stuff.
This works as of now - and is documented on facebook's site # http://developers.facebook.com/docs/authentication/. Not sure how recently it was added to the documentation, pretty sure it wasn't there when I checked Feb-2012
You can programmatically log the user our of Facebook by redirecting
the user to
https://www.facebook.com/logout.php?next=YOUR_REDIRECT_URL&access_token=USER_ACCESS_TOKEN
This solution no longer works with FaceBook's current API (seems it was unintended to begin with)
http://m.facebook.com/logout.php?confirm=1&next=http://yoursitename.com;
Try to give this link on you signout link or button where "yoursitename.com"
is where u want to redirect back after signout may be ur home page.
It works..
I can programmatically log user out Facebook by redirecting user to
https://www.facebook.com/logout.php?next=YOUR_REDIRECT_URL&access_token=USER_ACCESS_TOKEN
The URL supplied in the next parameter must be a URL with the same base domain as your application as defined in your app's settings.
More details: https://developers.facebook.com/docs/authentication
You can do this with the access_token:
$access_array = split("\|", $access_token);
$session_key = $access_array[1];
You can use that $session key in the PHP SDK to generate a functional logout URL.
$logoutUrl = $facebook->getLogoutUrl(array('next' => $logoutUrl, 'session_key' => $session_key));
This ends the browser's facebook session.
With PHP I'm doing:
logout.
if(isset($_GET['action']) && $_GET['action'] === 'logout'){
$facebook->destroySession();
header(WHERE YOU WANT TO REDIRECT TO);
exit();
}
Works and is nice and easy am just trying to find a logout button graphic now!
Here's an alternative to the accepted answer that works in the current (2.12) version of the API.
Logout
<script>
FB.init({
appId: '{your-app-id}',
cookie: true,
xfbml: true,
version: 'v2.12'
});
function logoutFromFacebookAndRedirect(redirectUrl) {
FB.getLoginStatus(function (response) {
if (response.status == 'connected')
FB.logout(function (response) {
window.location.href = redirectUrl;
});
else
window.location.href = redirectUrl;
});
}
</script>
the mobile solution suggested by Sumit works perfectly for AS3 Air:
html.location = "http://m.facebook.com/logout.php?confirm=1&next=http://yoursitename.com"
For Python developers that want to log user out straight from the backend
At the moment I'm writing this, the trick with m.facebook.com no longer works (at least for me) and user is redirected to the mobile FB login page which obviously is not good for UX.
Fortunately, FB PHP SDK has a semi-documented solution (in case the link doesn't lead to getLogoutUrl() function, just search look for it on that page). This is also mentioned in at least one other on StackOverflow: Facebook php SDK getLogoutUrl() problem.
BTW I've just noticed that Zach Greenberg got it right in this question, but I'm adding my answer as a summary for Python developers.
A note for Christoph's answer:
Facebook Oauth Logout
The logout function requires a callback function to be specified and will fail without
it, at least on Firefox. Chrome works without the callback.
FB.logout(function(response) {});
#Christoph: just adding someting . i dont think so this is a correct way.to logout at both places at the same time.(Logout).
Just add id to the anchor tag . <a id='fbLogOut' href="/logout" onclick="FB.logout();">Logout</a>
$(document).ready(function(){
$('#fbLogOut').click(function(e){
e.preventDefault();
FB.logout(function(response) {
// user is now logged out
var url = $(this).attr('href');
window.location= url;
});
});});
Update: This solution works and just a call to 'FB.logout()' doesn't work because browser wants a user interaction to actually call this function, so that it knows - it is a user not a script.
Logout
it's simple just type : $facebook->setSession(null); for logout