1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Apple OAuth

This commit is contained in:
David Bomba 2022-07-13 15:47:12 +10:00
parent a1befd96ac
commit dfd0670dba
3 changed files with 27 additions and 1 deletions

View File

@ -46,6 +46,8 @@ use Laravel\Socialite\Facades\Socialite;
use PragmaRX\Google2FA\Google2FA;
use Turbo124\Beacon\Facades\LightLogs;
use Microsoft\Graph\Model;
use Illuminate\Support\Facades\Http;
class LoginController extends BaseController
{
@ -336,7 +338,20 @@ class LoginController extends BaseController
} elseif (request()->input('provider') == 'apple') {
if (request()->has('token') || request()->has('auth_code')) {
$token = request()->has('token') ? request()->input('token') : request()->input('auth_code');
return $this->handleSocialiteLogin('apple', $token);
$response = Http::post('https://appleid.apple.com/auth/token', [
'grant_type' => 'authorization_code',
'code' => $token,
'redirect_uri' => config('ninja.ninja_apple_redirect_url'),
'client_id' => config('ninja.ninja_apple_client_id'),
'client_secret' => config('ninja.ninja_apple_client_secret'),
]);
nlog($response);
return $this->handleSocialiteLogin('apple', $response);
} else {
$message = 'Token is missing for the apple login';
}

View File

@ -194,5 +194,8 @@ return [
'ninja_apple_bundle_id' => env('APPLE_BUNDLE_ID', false),
'ninja_apple_issuer_id' => env('APPLE_ISSUER_ID', false),
'react_app_enabled' => env('REACT_APP_ENABLED', false),
'ninja_apple_client_id' => env('APPLE_CLIENT_ID', false),
'ninja_apple_client_secret' => env('APPLE_CLIENT_SECRET',false),
'ninja_apple_redirect_url' => env('APPLE_REDIRECT_URI',false),
];

View File

@ -39,6 +39,11 @@
{{ ctrans('texts.invoice_number') }}
</span>
</th>
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-primary">
<span role="button" wire:click="sortBy('number')" class="cursor-pointer">
{{ ctrans('texts.po_number') }}
</span>
</th>
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-primary">
<span role="button" wire:click="sortBy('date')" class="cursor-pointer">
{{ ctrans('texts.invoice_date') }}
@ -78,6 +83,9 @@
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
{{ $invoice->number }}
</td>
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
{{ $invoice->po_number }}
</td>
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
{{ $invoice->translateDate($invoice->date, $invoice->client->date_format(), $invoice->client->locale()) }}
</td>