rinordreshaj/apple-sign-in is a Laravel package for integrate apple sign in easily.
It currently has 23 GitHub stars and 750 downloads on Packagist (latest version 0.3.1).
Install it with composer require rinordreshaj/apple-sign-in.
Discover more Laravel packages by rinordreshaj
or browse all Laravel packages to compare alternatives.
Last updated
Integrate sign in with apple easily
This package provides an easy sign in with apple authentication model based on the apple specification
Require this package with composer using the following command:
composer require rinordreshaj/apple-sign-in
provide package name & service name generated from on the itunes connect on the .env file
APPLE_SIGN_IN_PACKAGE_NAME=your.package.name
APPLE_SIGN_IN_SERVICE_NAME=your.service.name
<?php
namespace App\Http\Controllers\API\Auth;
use Rinordreshaj\AppleSignIn\AppleSignIn;
class AppleSignInController extends Controller
{
public function login()
{
if(AppleSignIn::verify_signature($request->jwt_token))
{
// Authentication verified
$claims = AppleSignIn::get_token_claims($request->access_token);
$user = User::where([
'apple_identifier' => $claims->sub
])
->orWhere(["email" => $claims->email])
->first();
if(!$user)
{
// ADD user on database if it doesn't exists
$user = User::create([
"apple_identifier" => $claims->sub,
"email" => $claims->email,
"first_name" => $request->first_name,
"last_name" => $request->last_name,
"register_source" => "apple"
]);
// You can return the authenticated user object
}
}
}
The Laravel Sign in with Apple is open-sourced software licensed under the MIT license