{"id":33947515,"url":"https://github.com/mugnate/oauth2-ecwid","last_synced_at":"2026-04-08T13:32:16.702Z","repository":{"id":57021766,"uuid":"97057523","full_name":"mugnate/oauth2-ecwid","owner":"mugnate","description":"Ecwid OAuth 2.0 Client Provider for The PHP League OAuth2-Client","archived":false,"fork":false,"pushed_at":"2017-07-23T08:10:52.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-20T05:56:53.938Z","etag":null,"topics":["ecwid","oauth2"],"latest_commit_sha":null,"homepage":"","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/mugnate.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-12T22:36:02.000Z","updated_at":"2017-07-16T14:28:54.000Z","dependencies_parsed_at":"2022-08-22T20:20:14.965Z","dependency_job_id":null,"html_url":"https://github.com/mugnate/oauth2-ecwid","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mugnate/oauth2-ecwid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugnate%2Foauth2-ecwid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugnate%2Foauth2-ecwid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugnate%2Foauth2-ecwid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugnate%2Foauth2-ecwid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mugnate","download_url":"https://codeload.github.com/mugnate/oauth2-ecwid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugnate%2Foauth2-ecwid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31558381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T10:21:54.569Z","status":"ssl_error","status_checked_at":"2026-04-08T10:21:38.171Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ecwid","oauth2"],"created_at":"2025-12-12T18:01:44.968Z","updated_at":"2026-04-08T13:32:16.694Z","avatar_url":"https://github.com/mugnate.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ecwid Provider for OAuth 2.0 Client\n[![Latest Version](https://img.shields.io/github/release/mugnate/oauth2-ecwid.svg?style=flat-square)](https://github.com/mugnate/oauth2-ecwid/releases)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/mugnate/oauth2-ecwid/master.svg?style=flat-square)](https://travis-ci.org/mugnate/oauth2-ecwid)\n[![Quality Score](https://img.shields.io/scrutinizer/g/mugnate/oauth2-ecwid.svg?style=flat-square)](https://scrutinizer-ci.com/g/mugnate/oauth2-ecwid)\n[![Total Downloads](https://img.shields.io/packagist/dt/mugnate/oauth2-ecwid.svg?style=flat-square)](https://packagist.org/packages/mugnate/oauth2-ecwid)\n\nThis package provides Ecwid (https://www.ecwid.com/) 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 mugnate/oauth2-ecwid\n```\n\n## Usage\n\nUsage is the same as The League's OAuth client, using `\\League\\OAuth2\\Client\\Provider\\Ecwid` as the provider.\n\n### Configuration\n\n```php\n$provider = new Mugnate\\OAuth2\\Client\\Provider\\Ecwid([\n    'clientId'          =\u003e '{ecwid-client-id}',\n    'clientSecret'      =\u003e '{ecwid-client-secret}',\n    'redirectUri'       =\u003e 'https://yoursite.com/callback-url',\n]);\n```\n\n### Link\n```php\n$authUrl = $provider-\u003egetAuthorizationUrl();\n$_SESSION['oauth2-ecwid-state'] = $provider-\u003egetState();\n\necho '\u003ca href=\"' .$authUrl. '\"\u003e\u003c/a\u003e';\n```\n\n### Callback\n```php\nif (! isset($_GET['code'])) {\n    exit('Invalid code');\n}\n// Check given state against previously stored one to mitigate CSRF attack\nelseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2-ecwid-state'])) {\n\n    unset($_SESSION['oauth2-ecwid-state']);\n    exit('Invalid state');\n\n} else {\n\n    try {\n\n        // Try to get an access token (using the authorization code grant)\n        $token = $provider-\u003egetAccessToken('authorization_code', [\n            'code' =\u003e $_GET['code']\n        ]);\n\n    } catch (Exception $e) {\n\n        // Failed to get user details\n        exit('Oh dear...');\n    }\n\n    // Optional: Now you have a token you can look up a users profile data\n    try {\n\n        // We got an access token, let's now get the user's details\n        $user = $provider-\u003egetResourceOwner($token);\n\n        // Use these details to create a new profile\n        printf('Your email %s!', $user-\u003egetEmail());\n\n    } catch (Exception $e) {\n\n        // Failed to get user details\n        exit('Oh dear...');\n    }\n\n    // Use this to interact with an API on the users behalf\n    echo $token-\u003egetToken();\n}\n```\n\n### Managing Scopes\n\nWhen creating your Ecwid authorization URL, you can specify the state and scopes your application may authorize.\n\n```php\n$options = [\n    'state' =\u003e 'OPTIONAL_CUSTOM_CONFIGURED_STATE',\n    'scope' =\u003e ['read_store_profile', 'read_catalog', 'read_orders'] // array or string\n];\n\n$authorizationUrl = $provider-\u003egetAuthorizationUrl($options);\n```\n\n## Testing\n\n``` bash\n$ ./vendor/bin/phpunit\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/mugnate/oauth2-ecwid/blob/master/CONTRIBUTING.md) for details.\n\n\n## Credits\n\n- [Nikolay Votintsev](https://github.com/votintsev)\n- [All Contributors](https://github.com/mugnate/oauth2-ecwid/contributors)\n\n\n## License\n\nThe MIT License (MIT). Please see [License File](https://github.com/mugnate/oauth2-ecwid/blob/master/LICENSE) for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmugnate%2Foauth2-ecwid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmugnate%2Foauth2-ecwid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmugnate%2Foauth2-ecwid/lists"}