{"id":20103186,"url":"https://github.com/dotkernel/dot-auth-social","last_synced_at":"2025-05-06T08:31:11.777Z","repository":{"id":63306657,"uuid":"566850125","full_name":"dotkernel/dot-auth-social","owner":"dotkernel","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-14T15:25:48.000Z","size":103,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"1.0","last_synced_at":"2025-05-05T00:52:27.610Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.dotkernel.org/dot-auth-social/","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/dotkernel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-16T14:52:51.000Z","updated_at":"2025-03-05T15:01:51.000Z","dependencies_parsed_at":"2024-04-15T10:03:53.412Z","dependency_job_id":null,"html_url":"https://github.com/dotkernel/dot-auth-social","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.2857142857142857,"last_synced_commit":"6fcc31b3bcb5d781a86f719aa371e7fcb69c4256"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-auth-social","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-auth-social/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-auth-social/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-auth-social/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotkernel","download_url":"https://codeload.github.com/dotkernel/dot-auth-social/tar.gz/refs/heads/1.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252648574,"owners_count":21782405,"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":[],"created_at":"2024-11-13T17:34:40.476Z","updated_at":"2025-05-06T08:31:11.768Z","avatar_url":"https://github.com/dotkernel.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dot-auth-social\n\nDotkernel's component used to authenticate users through Facebook and return credentials and user details.\n\n\u003e dot-auth-social is a wrapper on top of [thephpleague/oauth2-client](https://github.com/thephpleague/oauth2-client) social providers.\n\n## Documentation\n\nDocumentation is available at: https://docs.dotkernel.org/dot-auth-social/.\n\n## Badges\n\n![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-auth-social)\n![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-auth-social/1.4.0)\n\n[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-auth-social)](https://github.com/dotkernel/dot-auth-social/issues)\n[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-auth-social)](https://github.com/dotkernel/dot-auth-social/network)\n[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-auth-social)](https://github.com/dotkernel/dot-auth-social/stargazers)\n[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-auth-social)](https://github.com/dotkernel/dot-auth-social/blob/1.0/LICENSE.md)\n\n[![Build Static](https://github.com/dotkernel/dot-auth-social/actions/workflows/continuous-integration.yml/badge.svg?branch=1.0)](https://github.com/dotkernel/dot-auth-social/actions/workflows/continuous-integration.yml)\n[![codecov](https://codecov.io/gh/dotkernel/dot-auth-social/graph/badge.svg?token=VIHN1HK8DR)](https://codecov.io/gh/dotkernel/dot-auth-social)\n[![PHPStan](https://github.com/dotkernel/dot-auth-social/actions/workflows/static-analysis.yml/badge.svg?branch=1.0)](https://github.com/dotkernel/dot-auth-social/actions/workflows/static-analysis.yml)\n\n## Requirements\n\n- **PHP**: 8.1, 8.2, 8.3 or 8.4\n\n## Installation\n\nRun the following command in your project directory:\n\n```shell\ncomposer require dotkernel/dot-auth-social\n```\n\nAfter installing, add the `ConfigProvider` class to your configuration aggregate.\n\nCreate a new file `social-authentication.global.php` in `config/autoload` with the following contents:\n\n```php\nreturn [\n    'social_authentication' =\u003e [\n        'facebook' =\u003e [\n            'client_id' =\u003e '',\n            'client_secret' =\u003e '',\n            'redirect_uri' =\u003e '',\n            'graph_api_version' =\u003e '',\n        ]\n    ]\n];\n```\n\n\u003e Make sure to populate the array with your credentials.\n\n## Usage\n\nIn this example we will create a new controller, but you can use an existing one too.\n\n```php\n\u003c?php\n\nnamespace Frontend\\User\\Controller;\n\nuse Dot\\Controller\\AbstractActionController;\nuse Dot\\AuthSocial\\Service\\AuthenticationServiceInterface;\nuse Laminas\\Diactoros\\Response\\RedirectResponse;\nuse Psr\\Http\\Message\\ResponseInterface;\n\nclass FacebookController extends AbstractActionController\n{\n    private AuthenticationServiceInterface $service;\n\n    public function __construct(AuthenticationServiceInterface $service)\n    {\n        $this-\u003eservice = $service;\n    }\n\n    public function authAction(): ResponseInterface\n    {\n        $code = $this-\u003erequest-\u003egetQueryParams()['code'] ?? false;\n        if (! $code) {\n            return new RedirectResponse($this-\u003eservice-\u003egetAuthorizationUrl());\n        }\n\n        $result = $this-\u003eservice-\u003eauthenticate($code);\n        if (! $result-\u003eisValid()) {\n            // invalid authentication, check $result-\u003egetMessages() for errors.\n        } else {\n            // valid authentication, use $result-\u003egetArrayCopy() to get the user details\n        }\n    }\n}\n```\n\nCreate a factory for the controller:\n\n```php\n\u003c?php\n\nuse Dot\\AuthSocial\\Service\\FacebookService;\nuse Psr\\Container\\ContainerInterface;\n\nclass FacebookControllerFactory\n{\n    public function __invoke(ContainerInterface $container): FacebookController\n    {\n        return new FacebookController($container-\u003eget(FacebookService::class));\n    }\n}\n```\n\nMake sure to register your controller with the factory in `ConfigProvider`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotkernel%2Fdot-auth-social","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotkernel%2Fdot-auth-social","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotkernel%2Fdot-auth-social/lists"}