Added Etsy Auth
This commit is contained in:
25
assets/php/etsyData/authorizeEtsy.php
Normal file
25
assets/php/etsyData/authorizeEtsy.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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;
|
||||
?>
|
||||
Reference in New Issue
Block a user