PHP code example of shinhyungjune / social-login
1. Go to this page and download the library: Download shinhyungjune/social-login library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shinhyungjune / social-login example snippets
// Usage description here
Route::get("/", function(){
return \Inertia\Inertia::render("Home");
});
Route::get("/home", function(){
return \Inertia\Inertia::render("Home");
});
Route::middleware("guest")->group(function(){
Route::get("/openLoginPop/{social}", [\ShinHyungJune\SocialLogin\Http\UserController::class, "openSocialLoginPop"]);
Route::get("/login", [\ShinHyungJune\SocialLogin\Http\UserController::class, "index"])->name("login");
Route::get("/login/{social}", [\ShinHyungJune\SocialLogin\Http\UserController::class, "socialLogin"]);
Route::post("/login", [\ShinHyungJune\SocialLogin\Http\UserController::class, "login"]);
Route::resource("/users", \ShinHyungJune\SocialLogin\Http\UserController::class);
Route::get("/passwordResets/{token}/edit", [\ShinHyungJune\SocialLogin\Http\PasswordResetController::class, "edit"]);
Route::resource("/passwordResets", \ShinHyungJune\SocialLogin\Http\PasswordResetController::class);
});
Route::middleware("auth")->group(function(){
Route::get("/logout", [\ShinHyungJune\SocialLogin\Http\UserController::class, "logout"]);
});
Route::get("/mailable", function(){
return (new \App\Mail\PasswordResetCreated(new \App\Models\User(), new \App\Models\PasswordReset()));
});
KAKAO_CLIENT_ID=
KAKAO_CLIENT_SECRET=
KAKAO_REDIRECT_URI={your_url}/login/kakao
NAVER_CLIENT_ID=
NAVER_CLIENT_SECRET=
NAVER_REDIRECT_URI={your_url}/login/naver
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URI={your_url}/login/google
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=
FACEBOOK_REDIRECT_URI={your_url}/login/facebook
protected $listen = [
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
// ... other providers
'SocialiteProviders\\Naver\\NaverExtendSocialite@handle',
'SocialiteProviders\\Kakao\\KakaoExtendSocialite@handle',
'SocialiteProviders\\Facebook\\FacebookExtendSocialite@handle',
'SocialiteProviders\\Google\\GoogleExtendSocialite@handle',
],
];
'naver' => [
'client_id' => env('NAVER_CLIENT_ID'),
'client_secret' => env('NAVER_CLIENT_SECRET'),
'redirect' => env('NAVER_REDIRECT_URI')
],
'kakao' => [
'client_id' => env('KAKAO_CLIENT_ID'),
'client_secret' => env('KAKAO_CLIENT_SECRET'),
'redirect' => env('KAKAO_REDIRECT_URI')
],
'google' => [
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
'redirect' => env('GOOGLE_REDIRECT_URI')
],
'facebook' => [
'client_id' => env('FACEBOOK_CLIENT_ID'),
'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
'redirect' => env('FACEBOOK_REDIRECT_URI')
],
protected $fillable = [
...
"social_id",
"social_platform"
];