New OAuth 2.0 Server for Nette

9 months ago

Member | 100

Do you need an OAuth authorization in your Nette application? Are you tired of Drahak/OAuth2? Now there's another option for you!


I was looking for OAuth solutions for Nette and there seems to be only one open source one – Drahak/OAuth2 – which is quite old and doesn't appear to be maintained. So I took The League of Extraordinary Packages' OAuth 2.0 Server and built a little library around it.

The package linked here is the base package, and then there is another one for related data storage using Kdyby/Doctrine. The purpose of this is to have the storage method separated from the OAuth functionality, so for example if you don't like Doctrine and want to store your tokens in Redis, you can just write your own storage package.

I will appreciate any and all feedback.

27 days ago

Member | 3

hi, I am trying to run your extension (!thanks for it!) but I can not get up the success..

having empty Nette app, trying AuthorizationCode GrantType


    oauth2: Lookyman\NetteOAuth2Server\Storage\Doctrine\NetteOAuth2ServerDoctrineExtension
        authCode: [authCodeTtl: P2Y4DT6H8M, pkce: on]
        clientCredentials: false
        implicit: false
        password: false
        refreshToken: false
    privateKey: /etc/ssl/oauth/private.key
    publicKey: /etc/ssl/oauth/
    approveDestination: ":Front:Approve:"
    loginDestination: ":Front:Sign:in"
    tablePrefix: nette_oauth2_server_
    loginEventPriority: 0


namespace App\FrontModule\Presenters;
use Lookyman\NetteOAuth2Server\UI\ApprovePresenterTrait;

class ApprovePresenter extends BasePresenter
    use ApprovePresenterTrait;
    public function actionDefault()



$router[] = new Route('oauth2/<action>', 'NetteOAuth2Server:OAuth2:default');
$router[] = new Route('<presenter>/<action>[/<text>]',
          [ 'presenter' => 'Homepage', 'action'=>'default','module' => 'Front' ]);

SQL schema generated by doctrine.

With different clients (one based on league/oauth2-client and second on ipub/oauth) get the same error and not redirected on Sign:in – “The authorization grant type is not supported by the authorization server.” – any idea what's wrong?

could be the problem using self-signed certificates in dev environment? – or I've missed something in docs?

thank you in advance


Board footer

Terms and conditions