şöyle bir hata alıyorum. Hata: Undefined method called: "getAuthorizationUrl"
<?php
require 'vendor/autoload.php';
use Github\Client;
session_start();
$githubClientId = 'xxxxxxx';
$githubClientSecret = 'xxxxxx';
$redirectUri = 'http://xx.xx.xx.xx/';
$client = new Client();
try {
if (isset($_GET['code'])) {
// GitHub'tan gelen code parametresini kullanarak token al
$token = $client->authenticate($githubClientId, $githubClientSecret, $_GET['code']);
// Token'ı sakla veya kullan
$_SESSION['github_token'] = $token;
// Kullanıcı bilgilerini al
$user = $client->api('current_user')->show();
// Kullanıcı bilgilerini kullan
echo 'Merhaba, ' . $user['login'];
} else {
// GitHub OAuth sayfasına yönlendir
$oauthUrl = $client->getAuthorizationUrl($githubClientId, $redirectUri, ['user']);
header('Location: ' . $oauthUrl);
exit;
}
} catch (\Exception $e) {
// Hata durumunda hatayı ekrana yazdır
echo 'Hata: ' . $e->getMessage();
}
?>