Comments (16)
Hi,
You try to pass the Revolut code without authenticate your Revolut access.
In your code, you get the Authorization Url. You should use it to redirect the visitor to the Revolut Authorization form.
Hope this could help.
require "vendor/autoload.php";
$authProvider = new \RevolutPHP\Auth\Provider([
'clientId' => 'BLABLABLAmyid', // As shown when uploading your key
'privateKey' => 'blablabla/pathto my private key/privatekey.pem',
'redirectUri' => 'web link that i indicated into public key', // The URL to redirect the user to after the authorisation step
'isSandbox' => true
]);
Here is the most important thing
if($_GET["code"]=='') {
$url = $authProvider->getAuthorizationUrl();
header("location:".$url); // This header will redirect the user if you didn't get Revolut code through GET.
}
$accessToken = $authProvider->getAccessToken('authorization_code', [
'code' => $_GET['code']
]);
from revolut-php.
Not exacly.
Because i did all step by step indication..
Can you make the step by step instrusction? Beetween installing software and setting things into revolut business account?
Because nlw its not too much clean. And you are the only one person with this kind of libraries.
Thank you
from revolut-php.
Hi, you should follow instructions described and test my solution.
Regards
from revolut-php.
Please permit me to show the problem by telegram.
Please contact. Thank you
from revolut-php.
I don't use telegram sorry, but i can support you here.
from revolut-php.
Ok sorry it was only for real time problem solving.
By the way.
I created the certificates. I created the key inside business account.
I get all the staff as you described. But it still get that error and i don't understand where is the problem.
Are you sure that there wasn'ylt any change into revolut rules about part of key management that could give me some kind of errors?
Because i saw they implemented a new staff like json web token.
Is it implemented in your library?
from revolut-php.
I am discovering the library actually.
What i can say is that your error is due to this line :
$accessToken = $authProvider->getAccessToken('authorization_code', ['code' => $_GET['code']
That's simple. Your variable is not set if you don't have ?code=xxxxxxxxxxxxxx in your URL.
If you want my code working, you have to set the REQUEST URI in your Revolut account to be the same as your php webpage. I don't know exactly if it is a good practice, as i am discovering the library.
In my account, my request URI is https://mywebsite.com/revolut/oauth.php
The code i give you is located to this page. That should work if you do the same, but i encounter an issue reloading this webpage with the code passed in URL (i opened a ticket).
I'm sure a developper could help us regarding this problem.
from revolut-php.
Uhm.
I send it to not exactly a file. But direction which send me to the index.php
But maybe that is the problem
I go to sleep now. Please check this chat in the next days. I will create a dedicated file like whatever.php
And will see
from revolut-php.
Please try this code, it should output an URL.
Copy this URL in your browser. Or tell me if you get any error.
require "vendor/autoload.php";
$authProvider = new \RevolutPHP\Auth\Provider([
'clientId' => 'BLABLABLAmyid', // As shown when uploading your key
'privateKey' => 'blablabla/pathto my private key/privatekey.pem',
'redirectUri' => 'web link that i indicated into public key', // The URL to redirect the user to after the authorisation step
'isSandbox' => true
]);
echo $url = $authProvider->getAuthorizationUrl();
from revolut-php.
Ok i try it now
from revolut-php.
You may access Revolut Authentification webpage. Connect to your account, and input your sms code. In case of success, you may be redirected to your request URI set in your Revolut Business account.
from revolut-php.
If you get an error, just copy the last line of your apache or nginx apache log here.
from revolut-php.
on running that code i have a blank page:
let me show you, i just gonna change my domain due to the privacy reasons:
only domain will be changed (and also some characters of key)
this is the link after sms. (as you see i sent it to direction "amministrazione" so to index of that direction.
https://mydomain.com/amministrazione/?code=oa_prod_qbFSGdBw6ZD9pTStDHpLO4lMq4Zn8YJn_gnUW5M3SSQ&state=
than i run into https://mydomain.com/payments/ this code
require "vendor/autoload.php";
$authProvider = new \RevolutPHP\Auth\Provider([
'clientId' => 'kX0mpaJdri-IB6zhtUGHNJFZeV6rWtWEw1DY6FacRQM', // As shown when uploading your key
'privateKey' => 'file:///var/www/www-root/data/www/mydomanin.com/payments/test/privatekey.pem',
'redirectUri' => 'https://mydomanin.com/amministrazione/', // The URL to redirect the user to after the authorisation step
'isSandbox' => false
]);
$url = $authProvider->getAuthorizationUrl();
and nothing happn
from revolut-php.
from revolut-php.
yeah sure, i put random digits of the same lenght, it's not mine client id :)
but the way now i see, there is the link. (again with random digits that i will put)
so answer is
https://business.revolut.com/app-confirm?state=74d5560826a85a966153893fa2c95c03&scope=READ&response_type=code&approval_prompt=auto&redirect_uri=https%3A%2F%2Fmydomanin.com%2Famministrazione%2F&client_id=kX0mpaJdri-IB6zhtUGHNJFZeas5rWtWEw1DYa3w65QM
now im trying to take the access token which i need in order to access to my account.
than the errors starts:
$accessToken = $authProvider->getAccessToken('authorization_code', [
'code' => $_GET['code']
]);
tice: Undefined index: code in /var/www/www-root/data/www/mydomain.com/payments/index.php on line 53
Fatal error: Uncaught BadMethodCallException: Required parameter not passed: "code" in /var/www/www-root/data/www/mydomain.com/payments/vendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php:35 Stack trace: #0 /var/www/www-root/data/www/mydomain.com/payments/vendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php(53): League\OAuth2\Client\Grant\AbstractGrant->checkRequiredParameter('code', Array) #1 /var/www/www-root/data/www/mydomain.com/payments/vendor/league/oauth2-client/src/Grant/AbstractGrant.php(76): League\OAuth2\Client\Grant\AbstractGrant->checkRequiredParameters(Array, Array) #2 /var/www/www-root/data/www/mydomain.com/payments/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(535): League\OAuth2\Client\Grant\AbstractGrant->prepareRequestParameters(Array, Array) #3 /var/www/www-root/data/www/mydomain.com/payments/vendor/vdbelt/oauth2-revolut/src/Provider/Revolut.php(144): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object(League\OAuth2\Client\Grant\AuthorizationCode), Array) #4 /v in /var/www/www-root/data/www/mydomain.com/payments/vendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php on line 35
from revolut-php.
can you just share your code please? @Cyrilouletouriste
from revolut-php.
Related Issues (17)
- Revolut API ignores "type" queryFilter for Transactions
- Incorrect Request HOT 2
- Merchant API beta
- Token issue HOT 1
- counterparties->create does not work HOT 2
- create-payment: Required 'profile id' is missing HOT 4
- Guzzle 7 HOT 2
- Won't install above PHP 7.0
- Payment /pay authorization problem HOT 1
- Class "Lcobucci\JWT\Configuration" not found
- Problem with access to the account
- Authentication Error
- How does one check for the response HOT 14
- {"message":"Required 'payments' is missing","code":2101} HOT 4
- New version of this package, help needed? HOT 3
- Disabled API key => new authentication via OAuth HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from revolut-php.