JakyeRU / Larascord

Larascord is a package that allows you to authenticate users in your Laravel application using Discord.
https://larascord.jakye.me
MIT License
65 stars 13 forks source link

[BUG] callback 404 #104

Closed SevensRequiem closed 1 year ago

SevensRequiem commented 1 year ago

url: http://localhost/discord/callback?code=ZmiDMbrJpgU00Fx4JaiJLVRfB2q1B4

Not Found The requested URL was not found on this server.

web.php routes:

Route::get('/refresh', function () {
    $view = view('base');
    $query = request()->query('q');
    if ($query === 'uptime') {
        $view = view('function.uptime');
    } elseif ($query === 'counter') {
        $view = view('function.counter');
    } elseif ($query === 'chat') {
        $view = view('function.chat');
    }
    return $view;
});

//Route::get('/logout', [AuthenticatedSessionController::class, 'destroy'])->name('logout');
Route::get('/dashboard', function () {
    return view('dashboard');
})->middleware(['auth'])->name('dashboard');

Route::middleware('auth')->group(function () {
    Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
});

I don't think it installed the callback route?

JakyeRU commented 1 year ago

Hello,

Do you see anything related to Larascord if you run php artisan route:list?

You should see something like this: image

SevensRequiem commented 1 year ago

No I don't all I see is this:


   Error

  Class "App\Http\Controllers\Controller" not found

  at app\Http\Controllers\Auth\ConfirmablePasswordController.php:13
      9▕ use Illuminate\Support\Facades\Auth;
     10▕ use Illuminate\Validation\ValidationException;
     11▕ use Illuminate\View\View;
     12▕
  ➜  13▕ class ConfirmablePasswordController extends Controller
     14▕ {
     15▕     /**
     16▕      * Show the confirm password view.
     17▕      */

  1   vendor\composer\ClassLoader.php:576
  2   vendor\composer\ClassLoader.php:427

Unrelated to larascord maybe?

JakyeRU commented 1 year ago

That error seems to come from app\Http\Controllers\Auth\ConfirmablePasswordController.php, which indeed is unrelated to Larascord.

url: http://localhost/discord/callback?code=ZmiDMbrJpgU00Fx4JaiJLVRfB2q1B4

I tried installing the latest version of Larascord and using the discord route prefix, and everything seems to be working on my end. image

Did you install Larascord in a fresh Laravel application?

SevensRequiem commented 1 year ago

Did you install Larascord in a fresh Laravel application?

No I didn't. I forgot I had installed it to the application when another auth package was already installed, which I forgot about :p I installed it on a new laravel app and it's working fine now so the issue is resolved. Thanks

Another question, getting a user's ID in this is as simple as "user->userid" correct? That's how it was in wohalis php discord package and it is what I'm converting from.

JakyeRU commented 1 year ago

It's as simple as doing $user->id or auth()->id(). The user's ID in the database corresponds to their Discord ID.