protected function getAutologinLink(Authenticatable $user, $path = null)
    {
        if ($this->shouldDeleteExpiredTokens()) {
            $this->deleteExpiredTokens();
        }

        // Get the user ID to be associated with a token.
        $userId = $user->getAuthIdentifier();

        // Generate a random unique token that can be used for the link.
        $token = $this->getAutologinToken();

        // Save the token to storage.
        $this->provider->create([
            'user_id'    => $userId,
            'token'      => $token,
            'path'       => $path
        ]);

        // Return a link using the route from the configuration file and
        // the generated token.
        $routeName = config('autologin.route_name');

        return $this->generator->route($routeName, $token);
    }