Search code examples
laravelemail-verificationlaravel-jetstream

Laravel 8 Jetstream email verification “invalid signature” 403


Not sure what parts to post. The change password emails seem to work fine. But when ever I click on the email validation email, I get the 403 error. and I have no idea why? From User.php

   namespace App\Models;
    use Illuminate\Contracts\Auth\MustVerifyEmail;
    use Illuminate\Database\Eloquent\Factories\HasFactory;
    use Illuminate\Foundation\Auth\User as Authenticatable;
    use Illuminate\Notifications\Notifiable;
    use Laravel\Fortify\TwoFactorAuthenticatable;
    use Laravel\Jetstream\HasProfilePhoto;
    use Laravel\Sanctum\HasApiTokens;

    class User extends Authenticatable implements MustVerifyEmail
    {
    use HasApiTokens;
    use HasFactory;
    use HasProfilePhoto;
    use Notifiable;
    use TwoFactorAuthenticatable;

    protected $fillable = [
        'name', 'username', 'email', 'platform','password',
    ];
    from config\jetstream.php
    'features' => [
        // Features::termsAndPrivacyPolicy(),
        Features::profilePhotos(),
        // Features::api(),
        // Features::teams(['invitations' => true]),
        Features::accountDeletion(),
    ],
    namespace App\Providers;
    use Illuminate\Support\ServiceProvider;
    class AppServiceProvider extends ServiceProvider
    {
  
    public function register()
    {
        \URL::forceScheme('https');
    }

    /**
     * Bootstrap any application services.
    public function boot()
    {
        //
    }
    }

    Routes
    <?php
    use Illuminate\Support\Facades\Route;
    use app\Http\Controllers\WeaponsController;

Web Routes Here is where you can register web routes for your application. These routes are loaded by the RouteServiceProvider within a group which contains the "web" middleware group. Now create something great!

    Route::resource('weapons', 'App\Http\Controllers\WeaponsController') ->middleware('auth');

    Route::get('/', function () {
        return view('welcome');
    });

    Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
        return view('dashboard');
    })->name('dashboard');

    Route::get('/', function () {
        return view('welcome');
    });

I saw another post where something similar happened only when via a proxy server. I'm using Caddy2, could that have anything to do with it? It's insisting I add more detail, but I've got nothing more to add.


Solution

  • It was the proxy server. When I bypassed it, put a certificate directly on the web server it worked. So I did some research along that route and discovered this: https://stackoverflow.com/a/28798341/15361400 By Adding my proxy servers' ip address in the app\Http\Middleware\TrustProxies.php file where it says

    class TrustProxies extends Middleware
    {
        /**
         * The trusted proxies for this application.
         *
         * @var array|string|null
         */
        protected $proxies;
    

    change this last line to say protected $proxies = "Proxy servers IP address here"; took care it.