{"id":14987467,"url":"https://github.com/agungsugiarto/codeigniter4-socialite","last_synced_at":"2025-10-06T00:31:42.593Z","repository":{"id":43258116,"uuid":"339598407","full_name":"agungsugiarto/codeigniter4-socialite","owner":"agungsugiarto","description":"CodeIgniter4 Socialite is Forked from Laravel Socialite wrapper around OAuth 1 \u0026 OAuth 2 libraries for working with codeigniter4 compatibility.","archived":false,"fork":true,"pushed_at":"2022-03-12T03:07:52.000Z","size":656,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"5.x","last_synced_at":"2025-09-04T17:57:56.096Z","etag":null,"topics":["codeigniter4","oauth2","oauth2-client"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"laravel/socialite","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agungsugiarto.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":null,"support":null}},"created_at":"2021-02-17T03:14:22.000Z","updated_at":"2024-03-01T22:13:24.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/agungsugiarto/codeigniter4-socialite","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/agungsugiarto/codeigniter4-socialite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agungsugiarto%2Fcodeigniter4-socialite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agungsugiarto%2Fcodeigniter4-socialite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agungsugiarto%2Fcodeigniter4-socialite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agungsugiarto%2Fcodeigniter4-socialite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agungsugiarto","download_url":"https://codeload.github.com/agungsugiarto/codeigniter4-socialite/tar.gz/refs/heads/5.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agungsugiarto%2Fcodeigniter4-socialite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278542354,"owners_count":26004058,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["codeigniter4","oauth2","oauth2-client"],"created_at":"2024-09-24T14:14:39.551Z","updated_at":"2025-10-06T00:31:42.272Z","avatar_url":"https://github.com/agungsugiarto.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"- [About](#about)\n- [Introduction](#introduction)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Authentication](#authentication)\n    - [Routing](#routing)\n    - [Optional Parameters](#optional-parameters)\n    - [Access Scopes](#access-scopes)\n    - [Retrieving User Details](#retrieving-user-details)\n- [Contributing](#contributing)\n- [License](#license)\n\n## About\n\nCodeIgniter4 Socialite is Forked from [Laravel Socialite](https://github.com/laravel/socialite) wrapper around OAuth 1 \u0026 OAuth 2 libraries for working with codeigniter4 compatibility.\n\n## Introduction\n\nCodeIgniter4 Socialite provides an expressive, fluent interface to OAuth authentication with Facebook, Google, LinkedIn, GitHub, GitLab and Bitbucket. It handles almost all of the boilerplate social authentication code you are dreading writing.\n\n## Installation\n\nTo get started with Socialite, use the Composer package manager to add the package to your project's dependencies:\n\n```sh\ncomposer require agungsugiarto/codeigniter4-socialite\n```\n## Configuration\n\nCopy the config file from `vendor/agungsugiarto/codeigniter4-socialite/src/Config/Socialite.php` to config folder of your codeigniter4 application change the namespace to `Config` and change class extends from `BaseConfig` to `\\Fluent\\Socialite\\Config\\Socialite`\n\nBefore using Socialite, you will need to add credentials for the OAuth providers your application utilizes. These credentials should be placed in your application's `app/Config/Socialite.php` configuration file, and should use the key `facebook`, `linkedin`, `google`, `github`, `gitlab`, or `bitbucket`, depending on the providers your application requires:\n\n```php\n/**\n * {@inheritdoc}\n */\npublic $services = [\n    // ..\n    'github' =\u003e [\n        'client_id'     =\u003e '',\n        'client_secret' =\u003e '',\n        'redirect'      =\u003e '',\n    ],\n];\n```\n\n\u003e If the `redirect` option contains a relative path, it will automatically be resolved to a fully qualified URL.\n\n## Authentication\n### Routing\n\nTo authenticate users using an OAuth provider, you will need two routes: one for redirecting the user to the OAuth provider, and another for receiving the callback from the provider after authentication. The example controller below demonstrates the implementation of both routes:\n\n```php\nuse Fluent\\Socialite\\Facades\\Socialite;\n\n$routes-\u003eget('auth/redirect', function () {\n    return Socialite::driver('github')-\u003eredirect();\n});\n\n$routes-\u003eget('auth/callback', function () {\n    $user = Socialite::driver('github')-\u003euser();\n    // $user-\u003etoken\n});\n```\n\nThe `redirect` method provided by the `Socialite` facade takes care of redirecting the user to the OAuth provider, while the `user` method will read the incoming request and retrieve the user's information from the provider after they are authenticated.\n\n### Optional Parameters\n\nA number of OAuth providers support optional parameters in the redirect request. To include any optional parameters in the request, call the `with` method with an associative array:\n\n```php\nuse Fluent\\Socialite\\Facades\\Socialite;\n\nreturn Socialite::driver('google')\n    -\u003ewith(['hd' =\u003e 'example.com'])\n    -\u003eredirect();\n```\n\n\u003e When using the `with` method, be careful not to pass any reserved keywords such as `state` or `response_type`.\n\n### Access Scopes\n\nBefore redirecting the user, you may also add additional \"scopes\" to the authentication request using the `scopes` method. This method will merge all existing scopes with the scopes that you supply:\n\n```php\nuse Fluent\\Socialite\\Facades\\Socialite;\n\nreturn Socialite::driver('github')\n    -\u003escopes(['read:user', 'public_repo'])\n    -\u003eredirect();\n```\n\nYou can overwrite all existing scopes on the authentication request using the `setScopes` method:\n\n```php\nuse Fluent\\Socialite\\Facades\\Socialite;\n\nreturn Socialite::driver('github')\n    -\u003esetScopes(['read:user', 'public_repo'])\n    -\u003eredirect();\n```\n\n## Retrieving User Details\n\nAfter the user is redirected back to your authentication callback route, you may retrieve the user's details using Socialite's `user` method. The user object returned by the `user` method provides a variety of properties and methods you may use to store information about the user in your own database. Different properties and methods may be available depending on whether the OAuth provider you are authenticating with supports OAuth 1.0 or OAuth 2.0:\n\n```php\n$routes-\u003eget('/auth/callback', function () {\n    $user = Socialite::driver('github')-\u003euser();\n\n    // OAuth 2.0 providers...\n    $token = $user-\u003etoken;\n    $refreshToken = $user-\u003erefreshToken;\n    $expiresIn = $user-\u003eexpiresIn;\n\n    // All providers...\n    $user-\u003egetId();\n    $user-\u003egetNickname();\n    $user-\u003egetName();\n    $user-\u003egetEmail();\n    $user-\u003egetAvatar();\n});\n```\n\n#### Retrieving User Details From A Token (OAuth2)\n\nIf you already have a valid access token for a user, you can retrieve their details using Socialite's `userFromToken` method:\n```php\nuse Fluent\\Socialite\\Facades\\Socialite;\n\n$user = Socialite::driver('github')-\u003euserFromToken($token);\n```\n\n#### Stateless Authentication\n\nThe `stateless` method may be used to disable session state verification. This is useful when adding social authentication to an API:\n\n```php\nuse Fluent\\Socialite\\Facades\\Socialite;\n\nreturn Socialite::driver('google')-\u003estateless()-\u003euser();\n```\n## Contributing\n\nThank you for considering contributing to Socialite!.\n\n## License\n\nCodeIgniter4 Socialite is open-sourced software licensed under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagungsugiarto%2Fcodeigniter4-socialite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagungsugiarto%2Fcodeigniter4-socialite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagungsugiarto%2Fcodeigniter4-socialite/lists"}