-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
secret_template.php
38 lines (31 loc) · 1.9 KB
/
secret_template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
//Rename this file to secret.php after all fields have been entered
$bot_token = ''; // Obtained from your own server using twitch_oauth.php
$refresh_token = ''; // Obtained from your own server using twitch_oauth.php
$secret = 'oauth:'; /* Get your Chat OAuth Password here => https://twitchapps.com/tmi/ */
$bot_id = ''; // Obtained from https://dev.twitch.tv/console/apps
$bot_secret = ''; // Obtained from https://dev.twitch.tv/console/apps
$scope = ["user:edit","user:read:email","viewing_activity_read"];
/*
****************************************************************************
* Do not change anything below this line unless you know what you are doing
****************************************************************************
*/
if (! $bot_token || ! $refresh_token || ! $bot_id || $bot_secret || strlen($secret) < 10) {
echo '[FATAL ERROR] secret.php is not set up properly!';
die();
}
$token_type = "bearer"; //DO NOT CHANGE!
$expires_time = time()+60; // Obtained from your own server using twitch_oauth.php (Will be deprecated to be generated by Helix.php)
if (!file_exists(getcwd().'/temp/')) {
mkdir(getcwd().'/temp/', 0664, true);
file_put_contents(getcwd().'/temp/access_token.php', serialize($bot_token));
file_put_contents(getcwd().'/temp/refresh_token.php', serialize($refresh_token));
file_put_contents(getcwd().'/temp/expires_time.php', serialize($expires_time));
}
if ($token_blob = file_get_contents(getcwd().'/temp/access_token.php')) $bot_token = unserialize($token_blob);
if ($refresh_blob = file_get_contents(getcwd().'/temp/refresh_token.php')) $refresh_token = unserialize($refresh_blob);
//DO NOT CHANGE ANYTHING BELOW UNLESS YOU KNOW WHAT YOU'RE DOING!
if ($expires_blob = file_get_contents(getcwd().'/temp/expires_time.php')) $expires_in = unserialize($expires_blob);
$token_type = "bearer"; //Helix uses Authorization: Bearer instead of Authorization: Oauth
?>