{"id":18821147,"url":"https://github.com/compwright/oauth2-servicefusion","last_synced_at":"2026-02-04T14:34:21.450Z","repository":{"id":62710462,"uuid":"561929435","full_name":"compwright/oauth2-servicefusion","owner":"compwright","description":"Service Fusion OAuth 2.0 support for the PHP League's OAuth 2.0 Client","archived":false,"fork":false,"pushed_at":"2024-12-03T18:55:29.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-03T19:36:58.248Z","etag":null,"topics":["oauth2","oauth2-provider","servicefusion"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/compwright/oauth2-servicefusion","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/compwright.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"compwright"}},"created_at":"2022-11-04T20:27:36.000Z","updated_at":"2024-12-03T18:55:32.000Z","dependencies_parsed_at":"2024-12-03T19:31:48.294Z","dependency_job_id":"e77412db-b811-49c2-92a5-52e25976b051","html_url":"https://github.com/compwright/oauth2-servicefusion","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Foauth2-servicefusion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Foauth2-servicefusion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Foauth2-servicefusion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Foauth2-servicefusion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compwright","download_url":"https://codeload.github.com/compwright/oauth2-servicefusion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231810500,"owners_count":18430000,"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":["oauth2","oauth2-provider","servicefusion"],"created_at":"2024-11-08T00:34:35.509Z","updated_at":"2026-02-04T14:34:21.404Z","avatar_url":"https://github.com/compwright.png","language":"PHP","funding_links":["https://github.com/sponsors/compwright"],"categories":[],"sub_categories":[],"readme":"# Service Fusion Provider for OAuth 2.0 Client\n\n[![Latest Version](https://img.shields.io/github/release/compwright/oauth2-servicefusion.svg?style=flat-square)](https://github.com/compwright/oauth2-servicefusion/releases)\n[![Build Status](https://app.travis-ci.com/compwright/oauth2-servicefusion.svg?branch=master)](https://app.travis-ci.com/github/compwright/oauth2-servicefusion)\n[![Total Downloads](https://img.shields.io/packagist/dt/compwright/oauth2-servicefusion.svg?style=flat-square)](https://packagist.org/packages/compwright/oauth2-servicefusion)\n\nThis package provides Service Fusion OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).\n\n## Installation\n\nTo install, use composer:\n\n```\ncomposer require compwright/oauth2-servicefusion league/oauth2-client\n```\n\n## Usage\n\nUsage is the same as The League's OAuth client, using `\\Compwright\\OAuth2_Servicefusion\\Provider` as the provider.\n\n### Example: Authorization Code Flow\n\n```php\n$provider = new Compwright\\OAuth2_Servicefusion\\Provider([\n    'clientId'      =\u003e '{servicefusion-client-id}',\n    'clientSecret'  =\u003e '{servicefusion-client-secret}',\n    'redirectUri'   =\u003e 'https://example.com/callback-url'\n]);\n\nif (!isset($_GET['code'])) {\n    // If we don't have an authorization code then get one\n    $authUrl = $provider-\u003egetAuthorizationUrl();\n    $_SESSION['oauth2state'] = $provider-\u003egetState();\n    header('Location: ' . $authUrl);\n    exit;\n}\n\n// Check given state against previously stored one to mitigate CSRF attack\nif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {\n    unset($_SESSION['oauth2state']);\n    exit('Invalid state');\n}\n\n// Get an access token using the authorization code grant\n$token = $provider-\u003egetAccessToken('authorization_code', [\n    'code' =\u003e $_GET['code']\n]);\n\n// You can look up a users profile data\n$user = $provider-\u003egetResourceOwner($token);\nprintf('Hello %s!', $user-\u003egetId());\n\n// Use the token to interact with an API on the users behalf\necho $token-\u003egetToken();\n```\n\n## Testing\n\n```bash\n$ make test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/compwright/oauth2-servicefusion/blob/master/CONTRIBUTING.md) for details.\n\n\n## Credits\n\n- [Jonathon Hill](https://github.com/compwright)\n- [All Contributors](https://github.com/compwright/oauth2-servicefusion/contributors)\n\n\n## License\n\nThe MIT License (MIT). Please see [License File](https://github.com/compwright/oauth2-servicefusion/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompwright%2Foauth2-servicefusion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompwright%2Foauth2-servicefusion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompwright%2Foauth2-servicefusion/lists"}