Giter Site home page Giter Site logo

Comments (16)

Cyrilouletouriste avatar Cyrilouletouriste commented on September 2, 2024

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.

octapudus avatar octapudus commented on September 2, 2024

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.

Cyrilouletouriste avatar Cyrilouletouriste commented on September 2, 2024

Hi, you should follow instructions described and test my solution.

Regards

from revolut-php.

octapudus avatar octapudus commented on September 2, 2024

Please permit me to show the problem by telegram.
Please contact. Thank you

from revolut-php.

Cyrilouletouriste avatar Cyrilouletouriste commented on September 2, 2024

I don't use telegram sorry, but i can support you here.

from revolut-php.

octapudus avatar octapudus commented on September 2, 2024

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.

Cyrilouletouriste avatar Cyrilouletouriste commented on September 2, 2024

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.

octapudus avatar octapudus commented on September 2, 2024

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.

Cyrilouletouriste avatar Cyrilouletouriste commented on September 2, 2024

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.

octapudus avatar octapudus commented on September 2, 2024

Ok i try it now

from revolut-php.

Cyrilouletouriste avatar Cyrilouletouriste commented on September 2, 2024

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.

Cyrilouletouriste avatar Cyrilouletouriste commented on September 2, 2024

If you get an error, just copy the last line of your apache or nginx apache log here.

from revolut-php.

octapudus avatar octapudus commented on September 2, 2024

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.

Cyrilouletouriste avatar Cyrilouletouriste commented on September 2, 2024

from revolut-php.

octapudus avatar octapudus commented on September 2, 2024

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.

octapudus avatar octapudus commented on September 2, 2024

can you just share your code please? @Cyrilouletouriste

from revolut-php.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.