{"id":18864320,"url":"https://github.com/devtronic/oauth-client","last_synced_at":"2026-02-11T07:30:19.832Z","repository":{"id":56967205,"uuid":"102277656","full_name":"devtronic/oauth-client","owner":"devtronic","description":"A simple OAuth client","archived":false,"fork":false,"pushed_at":"2018-07-12T05:11:16.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-30T21:29:12.634Z","etag":null,"topics":[],"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/devtronic.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2017-09-03T16:22:26.000Z","updated_at":"2017-09-03T16:45:06.000Z","dependencies_parsed_at":"2022-08-21T06:10:26.146Z","dependency_job_id":null,"html_url":"https://github.com/devtronic/oauth-client","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/devtronic%2Foauth-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devtronic%2Foauth-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devtronic%2Foauth-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devtronic%2Foauth-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devtronic","download_url":"https://codeload.github.com/devtronic/oauth-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239808525,"owners_count":19700451,"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-08T04:40:52.522Z","updated_at":"2026-02-11T07:30:19.799Z","avatar_url":"https://github.com/devtronic.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OAuth Client\nThis is a simple client for OAuth Services (W.I.P.)\n\nCurrently included services:\n- Battle.net\n- Dropbox\n- Facebook\n- GitHub\n- Google\n- Instagram\n- PayPal\n- Shopify\n- Slack\n- Twitter\n\nMore OAuth2 services coming soon\n\n## Installation\n```bash\n$ composer require devtronic/oauth-client\n```\n\n## Usage\n\nOAuth 2.0\n```php\n\u003c?php\n\n$ro = new \\Devtronic\\OAuth\\ResourceOwner\\GoogleResourceOwner(\n    $clientId = '\u003cyour-client-id\u003e',\n    $clientSecret = '\u003cyour-client-secret\u003e',\n    $redirectUrl = '\u003cyour-redirect-url\u003e' # This script for example\n);\n\n# Prints all available scopes\n# print_r($ro-\u003egetScopes());\n\n$scopes = [\n    'https://www.googleapis.com/auth/userinfo.profile'\n];\n\nif (!isset($_REQUEST['code'])) {\n    header('location: ' . $ro-\u003egetAuthorizeUrl($scopes));\n    exit;\n} else {\n    $token = $ro-\u003egetAccessToken($scopes, $_REQUEST['code']);\n\n    $client = new \\GuzzleHttp\\Client(['verify' =\u003e false]);\n    $res = $client-\u003erequest('GET', 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json', [\n        'headers' =\u003e [\n            'Authorization' =\u003e sprintf('Bearer ' . $token-\u003egetToken()),\n        ]\n    ]);\n    echo '\u003cpre\u003e';\n    print_r(json_decode($res-\u003egetBody()-\u003egetContents(), true));\n}\n```\n\nOAuth 1.0\n```php\n\u003c?php\n\n$ro = new \\Devtronic\\OAuth\\ResourceOwner\\TwitterResourceOwner(\n    $consumerKey = '\u003cyour-consumer-key\u003e',\n    $consumerSecret = '\u003cyour-consumer-secret\u003e',\n    $redirectUrl = '\u003cyour-redirect-url\u003e' # This script for example\n);\n\nif (!isset($_REQUEST['oauth_token'])) {\n    header('location: ' . $ro-\u003egetAuthorizeUrl());\n    exit;\n} else {\n    // Get the Token\n    $token = $ro-\u003egetAccessToken($_REQUEST['oauth_token'], $_REQUEST['oauth_verifier']);\n    \n    // Start your own request\n    $client = new \\GuzzleHttp\\Client(['verify' =\u003e false]);\n    $url = 'https://api.twitter.com/1.1/account/verify_credentials.json';\n    $res = $client-\u003erequest('GET', $url, [\n        'headers' =\u003e [\n            // Sign the request and get the auth header\n            'Authorization' =\u003e $ro-\u003egetAuthorizationHeader(\n                'GET',   # Request Method \n                $url,    # Requested URL\n                [],      # Request Parameters (GET, POST etc.)\n                $token   # The previously received AccessToken\n            ),\n        ]\n    ]);\n    echo '\u003cpre\u003e';\n    print_r(json_decode($res-\u003egetBody()-\u003egetContents(), true));\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevtronic%2Foauth-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevtronic%2Foauth-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevtronic%2Foauth-client/lists"}