Hey Dan!
My code is like the guide, Auth0 Laravel SDK Quickstarts: Add Login to a Laravel Application
In web.php
Route::get( ‘/auth0/callback’, ‘\Auth0\Login\Auth0Controller@callback’ )->name( ‘auth0-callback’ );
Route::get( ‘/login’, ‘Auth\Auth0IndexController@login’ )->name( ‘login’ );
Route::get( ‘/auth/logout’, ‘Auth\Auth0IndexController@logout’ )->name( ‘logout’ )->middleware(‘auth’);
A controller
class Auth0IndexController extends Controller
{
/**
* Redirect to the Auth0 hosted login page
*
* @return mixed
*/
public function login()
{
$authorize_params = [
‘scope’ => ‘openid profile email’,
// Use the key below to get an access token for your API.
// ‘audience’ => config(‘laravel-auth0.api_identifier’),
];
return \App::make(‘auth0’)->login(null, null, $authorize_params);
}
/**
* Log out of Auth0
*
* @return mixed
*/
public function logout()
{
\Auth::logout();
$logoutUrl = sprintf(
'https://%s/v2/logout?client_id=%s&returnTo=%s',
env('AUTH0_DOMAIN'),
env('AUTH0_CLIENT_ID'),
env('APP_URL'));
return \Redirect::intended($logoutUrl);
}
}
In auth.php, I change the eloquent driver for
‘providers’ => [
‘users’ => [
‘driver’ => ‘auth0’
],
],
but I also have an admin.php where I have a driver and says eloquent,
‘providers’ => [
‘admin’ => [
‘driver’ => ‘eloquent’,
//‘driver’ => ‘auth0’,
‘model’ => App\Models\Administrator::class,
],
If I change for auth0 like commented, the old login doesn`t work.
And the register in appserviceprovder that use my own CustomUserRepository .
thanks!