finally got auth working
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AuthAccount extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name', 'email', 'avatar', 'owner_hash', 'id', 'expiresIn', 'token', 'refreshToken',
|
||||
];
|
||||
|
||||
public function user() {
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ class LoginController extends Controller
|
||||
|
||||
$user = $this->createOrGetUser($ssoUser);
|
||||
|
||||
auth()->login($user);
|
||||
auth()->login($user, true);
|
||||
|
||||
return redirect()->to('/dashboard');
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\AuthAccountService;
|
||||
use Socialite;
|
||||
use SocialiteUser;
|
||||
use App\User;
|
||||
|
||||
|
||||
|
||||
use DB;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
//use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Redirect the user to the Eve Online authentication page.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function redirectToProvider() {
|
||||
return Socialite::driver('eveonline')->setScopes(['publicData'])->redirect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the user information from Eve Online
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function handleProviderCallback(AuthAccountService $service) {
|
||||
$ssoUser = Socialite::driver('eveonline')->user();
|
||||
|
||||
$user = $service->createOrGetUser($ssoUser);
|
||||
|
||||
auth()->login($user);
|
||||
|
||||
return redirect()->to('/dashboard');
|
||||
dd($user);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateEsiTokensTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('esitokens', function (Blueprint $table) {
|
||||
$table->string('CharacterId');
|
||||
$table->string('AccessToken');
|
||||
$table->string('RefreshToken');
|
||||
$table->string('ExpiresIn');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('EsiTokens');
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AuthAccounts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('auth_accounts', function(Blueprint $table) {
|
||||
$table->integer('user_id');
|
||||
$table->string('provider_user_id');
|
||||
$table->string('provider');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('auth_accounts');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user