codigo actual del servidor, con avances de joan

This commit is contained in:
Jose Sanchez
2023-08-07 15:52:04 -04:00
commit 3cd9b8bbe8
3070 changed files with 532255 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Services\Revoke;
use Illuminate\Support\Facades\Http;
class AppleRevoke implements ProviderRevoke
{
public function apply()
{
$grant_type = "refresh_token";
$refresh_token = auth()->user()->refresh_token;
$client_id = env('SIGN_IN_WITH_APPLE_CLIENT_ID');
$client_secret = env('SIGN_IN_WITH_APPLE_CLIENT_SECRET');
$redirect_uri = env('SIGN_IN_WITH_APPLE_REDIRECT');
$server_output = Http::asForm()->post('https://appleid.apple.com/auth/token', [
'client_id' => $client_id,
'client_secret' => $client_secret,
'grant_type' => $grant_type,
'refresh_token' => $refresh_token,
'redirect_uri' => $redirect_uri,
]);
$access_token = $server_output->object()->access_token;
$revoke_output = Http::asForm()->post('https://appleid.apple.com/auth/revoke', [
'client_id' => $client_id,
'client_secret' => $client_secret,
'token_type_hint' => $grant_type,
'token' => $access_token,
]);
return $revoke_output->ok();
}
}