-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.php
More file actions
47 lines (42 loc) · 1.21 KB
/
Copy pathauth.php
File metadata and controls
47 lines (42 loc) · 1.21 KB
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
39
40
41
42
43
44
45
46
47
<?php
/**
* Spotify Api module for xoops
*
* @package spotifyapi
* @subpackage page-level
* @author Squiz Pty Ltd <products@squiz.net>
* @copyright 2023 Michael Albertsen (www.culex.dk)
* @since 1.0
* @min_xoops 2.5.9
*/
use XoopsModules\Spotifyapi;
require_once dirname(__DIR__, 2) . '/mainfile.php';
include __DIR__ . '/preloads/autoloader.php';
require_once __DIR__ . '/include/common.php';
require_once XOOPS_ROOT_PATH . '/class/template.php';
$GLOBALS['xoopsLogger']->activated = false;
$block = [];
$helper = Spotifyapi\Spotifyapi_Helper::getInstance();
$clientid = $helper->getConfig('spotifyapiclientid');
$clientsecret = $helper->getConfig('spotifyapiclientsecret');
$clientredirecturi = $helper->getConfig('spotifyapiredirecturi');
$session = new XoopsModules\Spotifyapi\Spotifyapi_Session(
$clientid,
$clientsecret,
$clientredirecturi
);
try {
$state = $session->generateState();
} catch (Exception $e) {
}
$_SESSION['state'] = $state;
$options = [
'scope' => [
'user-read-currently-playing',
'user-read-recently-played'
],
'state' => $state,
];
header("Content-type: application/javascript");
header('Location: ' . $session->getAuthorizeUrl($options));
die();