This is a package to integrate Fortnox authentication with the OAuth2 client library by The League of Extraordinary Packages.
composer require codepeak/oauth2-fortnox
$provider = new \Codepeak\OAuth2\Client\Provider\Fortnox([
'clientId' => "YOUR_CLIENT_ID",
'clientSecret' => "YOUR_CLIENT_SECRET",
'redirectUri' => "https://your.redirect.uri/full/url/path/here"
]);
$authorizationUrl = $provider->getAuthorizationUrl(['scope' => ['companyinformation', 'profile']]);
$token = $provider->getAccessToken("authorization_code", [
'code' => $_GET['code']
]);
$token = $provider->getAccessToken("refresh_token", [
'refresh_token' => $refreshToken
]);