addRepository(new ClientRepository()); $server->addRepository(new ScopeRepository()); $server->addRepository(new AccessTokenRepository()); $server->addRepository(new UserRepository()); // Enable the password grant $server->enableGrantType('PasswordGrant'); // Setup app + routing $application = new \Proton\Application(); $application->post('/access_token', function (Request $request) use ($server) { try { return $server->getAccessTokenResponse($request); } catch (OAuthException $e) { return $e->generateHttpResponse(); } }); // Run the app $application->run();