Jump to content

Problem with access to the account


DavLn

Recommended Posts

But - where is the code?  A lot of us are afraid (rightfully so) to click on posters links.  Pick out the part of your code that is giving you this message and post it here in the <> tags(above) And be sure to tell us which line matches the error message line number.

Link to comment
Share on other sites

<?php
	require("vendor/autoload.php");
    //...
    $authProvider = new \RevolutPHP\Auth\Provider([
        'clientId' => '{clientId}', // As shown when uploading your key
        'privateKey' => 'sk_F7PVCXsUUMlQpGRYz3lN1Yxd-KsGkdYbjVbFugwPoWkvvqGOukcnlajxTOS8mrNV',
        'redirectUri' => 'pk_HiQdMyLEmjpHBnAemaaklQqatz2pTfzdJrRCEhn0rAVqrxZK', // The URL to redirect the user to after the authorisation step
        'isSandbox' => true
        ]);
     // redirect the user to the authorization flow in the Revolut for Business app
    echo $url = $authProvider->getAuthorizationUrl();
     // Authorized user -> authorization code against an access token
    $accessToken = $authProvider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);
?>

Sorry, I forgot to post my code, but the link is safe, it's a link to a tutorial on the API that I'm following. And the error is on line 14

Edited by DavLn
Link to comment
Share on other sites

When you run this script, are you putting a value for "code" in the query string?

EG

http://localhost/myscript.php?code=123

Check whether code exists before trying to access it

if (isset($_GET['code']) {

    $accessToken = $authProvider->getAccessToken('authorization_code', [
            'code' => $_GET['code']
        ]);
}
else {

    // error - no code

}

 

Link to comment
Share on other sites

I tried to put a value in "code" but I got an endless list of errors...And I attached the list of errors I got putting a value in "code".

This is the code

<?php
require("vendor/autoload.php");
    //...
    $authProvider = new \RevolutPHP\Auth\Provider([
        'clientId' => '{clientId}', // As shown when uploading your key
        'privateKey' => 'sk_F7PVCXsUUMlQpGRYz3lN1Yxd-KsGkdYbjVbFugwPoWkvvqGOukcnlajxTOS8mrNV',
        'redirectUri' => 'pk_HiQdMyLEmjpHBnAemaaklQqatz2pTfzdJrRCEhn0rAVqrxZK', // The URL to redirect the user to after the authorisation step
        'isSandbox' => true
        ]);
     // redirect the user to the authorization flow in the Revolut for Business app
    // echo $url = $authProvider->getAuthorizationUrl();
     // Authorized user -> authorization code against an access token
     if(isset($_GET['code'])){

        $accessToken = $authProvider->getAccessToken('authorization_code', [
            'code' => $_GET['code']
        ]);
     }
     else{
        // error - no code
     }
?>

image.thumb.png.65a1cce4595c4db6e0f25218080bce1b.png

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.