https://github.com/robertgrubb/twitch-login-php
Simple class for handling Twitch TV authentication and retrieving user information
https://github.com/robertgrubb/twitch-login-php
authentication twitch twitch-api twitch-tv user
Last synced: 11 months ago
JSON representation
Simple class for handling Twitch TV authentication and retrieving user information
- Host: GitHub
- URL: https://github.com/robertgrubb/twitch-login-php
- Owner: RobertGrubb
- Created: 2020-03-08T03:04:08.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-08T13:40:21.000Z (almost 6 years ago)
- Last Synced: 2025-01-16T16:45:59.373Z (about 1 year ago)
- Topics: authentication, twitch, twitch-api, twitch-tv, user
- Language: PHP
- Homepage:
- Size: 1.95 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Twitch Login
This is a simple PHP library that shows you how to handle authentication through Twitch by allowing access to your application, grabbing the access token, then grabbing the user information from there.
# Usage
To instantiate:
```
$Twitch = new Twitch($credentials);
```
`$credentials` is an array with the following:
```
[
'CLIENT_ID' => '',
'CLIENT_SECRET' => '',
'REDIRECT_URI' => ''
]
```
To login echo the following on your page:
```
$Twitch->authUrl();
```
Then, when the code is returned, you can get user information by the following:
```
$Twitch->accessToken = $_GET['code'];
$userInfo = $Twitch->fetchUser('username');
```