26 lines
743 B
PHP
26 lines
743 B
PHP
<?php
|
|
include '/mnt/www-live/TechOdyssey_Designs_Dashboard/assets/php/session_check.php';
|
|
require '/mnt/www-live/TechOdyssey_Designs_Dashboard/assets/php/envLoader.php'; // Load envLoader from php/
|
|
loadEnv(__DIR__ . '/../../../.env'); // Go up three levels to root for .env
|
|
|
|
$clientId = $_ENV['ETSY_KEYSTRING'];
|
|
$redirectUri = $_ENV['ETSY_REDIRECT_URI'];
|
|
$scope = 'transactions_r';
|
|
$state = bin2hex(random_bytes(16));
|
|
|
|
session_start();
|
|
$_SESSION['oauth_state'] = $state;
|
|
|
|
// Authorization URL
|
|
$url = "https://www.etsy.com/oauth/connect?" . http_build_query([
|
|
'response_type' => 'code',
|
|
'client_id' => $clientId,
|
|
'redirect_uri' => $redirectUri,
|
|
'scope' => $scope,
|
|
'state' => $state
|
|
]);
|
|
|
|
header("Location: $url");
|
|
exit;
|
|
?>
|