{"id":22092110,"url":"https://github.com/krakphp/doctrine-oauth2","last_synced_at":"2025-03-23T23:44:58.388Z","repository":{"id":57009018,"uuid":"121317774","full_name":"krakphp/doctrine-oauth2","owner":"krakphp","description":"Doctrine and Laravel OAuth2 Integrations","archived":false,"fork":false,"pushed_at":"2018-03-17T04:49:06.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T06:52:25.429Z","etag":null,"topics":["doctrine-orm","laravel","oauth2"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krakphp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-12T23:59:26.000Z","updated_at":"2021-10-08T13:18:02.000Z","dependencies_parsed_at":"2022-08-21T14:50:46.997Z","dependency_job_id":null,"html_url":"https://github.com/krakphp/doctrine-oauth2","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fdoctrine-oauth2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fdoctrine-oauth2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fdoctrine-oauth2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fdoctrine-oauth2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krakphp","download_url":"https://codeload.github.com/krakphp/doctrine-oauth2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245186925,"owners_count":20574554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["doctrine-orm","laravel","oauth2"],"created_at":"2024-12-01T03:08:21.622Z","updated_at":"2025-03-23T23:44:58.362Z","avatar_url":"https://github.com/krakphp.png","language":"PHP","readme":"# Doctrine OAuth2\n\nThis library provides OAuth2 integration for Doctrine and Laravel. It uses the `league/oauth2-server` package for all of the heavy lifting and the Doctrine ORM for the backend.\n\n## Installation\n\nInstall with composer at `krak/doctrine-oauth2`\n\n## Laravel Usage\n\n```php\n\u003c?php\n\n$app = new Laravel\\Lumen\\Application(__DIR__ . '/..');\n\n$app-\u003eregister(LaravelDoctrine\\ORM\\DoctrineServiceProvider::class);\n$app-\u003eregister(LaravelDoctrine\\Migrations\\MigrationsServiceProvider::class);\n$app-\u003eregister(Krak\\DoctrineOAuth2\\OAuth2ServiceProvider::class);\n\n$app['oauth2.seeds']-\u003epush(function($em, $logger) {\n    $scopes = [\n        new Scope('basic', 'Basic', 'Allows basic access to the API.'),\n        new Scope('user', 'User', 'Allows user access to the API.'),\n    ];\n\n    $logger-\u003einfo(\"Creating local client\");\n    $client = new Client('local', 'local', 'local123', '', $scopes);\n    $em-\u003epersist($client);\n    foreach ($scopes as $scope) {\n        $logger-\u003einfo(\"Creating scope: \". json_encode($scope, JSON_PRETTY_PRINT));\n        $em-\u003epersist($scope);\n    }\n});\n\n$app-\u003erouter-\u003egroup(['middleware' =\u003e 'oauth2'], function($router) {\n    $router-\u003eget('/', function(Illuminate\\Http\\Request $req) {\n        return $req-\u003eattributes-\u003eall();\n    });\n});\n```\n\n\n```php\n\u003c?php\n\n// config/oauth2.php\n\nreturn [\n    'grants' =\u003e [\n        'refresh_token',\n        'password',\n        'client_credentials',\n        'authorization_code',\n        'implicit'\n    ],\n    'client_credentials' =\u003e [\n        'access_token_ttl' =\u003e new DateInterval('P1Y'),\n    ],\n    'access_token_ttl' =\u003e new DateInterval('PT2H'),\n    'refresh_token_ttl' =\u003e new DateInterval('P2Y'),\n    'private_key' =\u003e resource_path('oauth-private.key'),\n    'public_key' =\u003e resource_path('oauth-public.key'),\n];\n```\n\nYou need to run `./artisan oauth2:generate-keys` to create the oauth keys. You can optionally run `./artisan oauth2:seed` to run any seeds you may have defined for the oauth2 package.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakphp%2Fdoctrine-oauth2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrakphp%2Fdoctrine-oauth2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakphp%2Fdoctrine-oauth2/lists"}