paypal / PayPal-PHP-SDK

PHP SDK for PayPal RESTful APIs
https://developer.paypal.com/docs/api/
Other
25 stars 96 forks source link

Get User Consent URL sample not working #1078

Closed aggelito closed 6 years ago

aggelito commented 6 years ago

General information

Issue description

I want the customer to be able to log into PayPal from our site but following the SDK sample code to obtain user's consent (Sample code).

When I redirect to the url provided by the SDK, PayPal shows an empty site saying "An error has occurred. It seems that this action is not supported. Report this error so we can help with it in the future. (invalid client_id or redirect_uri)".

I'm already using the SDK for payments and refunds and that works so shouldn't be incorrect client_id.

I've checked my rest API application in the developers console and activated "Log in with PayPal" and ticked all the user information request options just in case but the problem remains for both sandbox and live mode.

Example url: (https://www.sandbox.paypal.com/signin/authorize?client_id=my_client_id&response_type=code&scope=openid+email&redirect_uri=http%3A%2F%2Fmysite.ci%2Fcustomer%2Flinkpaypal%3Fsuccess%3Dtrue)

Anyone knows what could be causing this problem?

xiaoleih41 commented 6 years ago

What's the redirect url? It should be the one matching to the one listed in your app.

aggelito commented 6 years ago

Following the sample code, the "$redirectUrl" is my example in the bottom, https://www.sandbox.paypal.com/signin/authorize?client_id=my_client_id&response_type=code&scope=openid+email&redirect_uri=http%3A%2F%2Fmysite.ci%2Fcustomer%2Flinkpaypal%3Fsuccess%3Dtrue.

And the "$baseUrl" is the url included as a get-variable "redirect_url", which decoded is http://mysite.ci/customer/linkpaypal?success=true. I have tried adding this to the app "Return URL"-list in my app (as you do for payments) but still not working

xiaoleih41 commented 6 years ago

Does https://github.com/paypal/PayPal-PHP-SDK/issues/894 help with your situation?

aggelito commented 6 years ago

I didn't use the state parameter before, but now all of a sudden it started working without any changes just like #894. I guess the account settings sometimes take a long time before changes take effect. Thanks for the help!