Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

RobyFerro's avatar

ERR_UNSAFE_REDIRECT when Laravel Passport redirect URL points to a Chrome extension

I've some trouble with authenticating a Google Chrome extension with my Laravel project. I used Chrome identity library for client-side and Passport in server-side. Everything work well till Passport tries to redirect to Chrome extension URL (as callback URL).

This is the client-side method:

let httpBuildQuery = require('http-build-query');

    let auth_url = 'https://my-laravel-project/oauth/authorize',
        client_id = '<client-id>',
        redirect_url = "chrome-extension://<ext-id>/pages/panel.html",
        auth_params = {
            client_id: client_id,
            redirect_uri: redirect_url,
            response_type: 'token',
            scope: ''
        };

        auth_url += '?' + httpBuildQuery(auth_params);
                
        chrome.identity.launchWebAuthFlow({url: auth_url, interactive: true}, function(responseUrl) {
            console.log(responseUrl);
        });

Chrome gives me this error: "Authorization page could not be loaded"

I even try to put auth URL directly in the browser but I get an ERR_UNSAFE_REDIRECT.

Everything should be set correctly, even in manifest.json. Does someone know why this happens? I really appreciate your help.

Thanks in advance.

0 likes
1 reply
RobyFerro's avatar

Seems that Chrome considers safe only redirect with HTTP/HTTPS URL. The only way that I found to fix this problem is to create a login form based on Personal access token method.

Please or to participate in this conversation.