New OAuth 2.0 Server for Nette

Notice: This thread is very old.
looky
Member | 99
+
+4
-

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

Lookyman/NetteOAuth2Server

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.

krkabol
Member | 5
+
0
-

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

config:

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

approvePresenter:

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

class ApprovePresenter extends BasePresenter
{
    use ApprovePresenterTrait;
    public function actionDefault()
    {
        $this['approve'];

    }
}

router:

$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

Petr