ERR_UNSAFE_REDIRECT 当 Laravel Passport 重定向 URL 指向 Chrome 扩展
ERR_UNSAFE_REDIRECT when Laravel Passport redirect URL points to a Chrome extension
我在使用 Laravel 项目验证 Google Chrome 扩展时遇到了一些问题。我在客户端使用 Chrome 身份库,在服务器端使用 Passport。一切正常,直到 Passport 尝试重定向到 Chrome 扩展名 URL(作为回调 URL)。
这是客户端方法:
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 给我这个错误:
Google Chrome console error
我什至尝试将 auth URL 直接放在浏览器中,但我得到一个 ERR_UNSAFE_REDIRECT.
一切都应该正确设置,即使在 manifest.json 中也是如此。有人知道为什么会这样吗?非常感谢您的帮助。
提前致谢。
似乎 Chrome 认为仅使用 HTTP/HTTPS URL 重定向是安全的。我发现解决这个问题的唯一方法是创建一个基于 Personal access token method.
的登录表单
我在使用 Laravel 项目验证 Google Chrome 扩展时遇到了一些问题。我在客户端使用 Chrome 身份库,在服务器端使用 Passport。一切正常,直到 Passport 尝试重定向到 Chrome 扩展名 URL(作为回调 URL)。
这是客户端方法:
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 给我这个错误: Google Chrome console error
我什至尝试将 auth URL 直接放在浏览器中,但我得到一个 ERR_UNSAFE_REDIRECT.
一切都应该正确设置,即使在 manifest.json 中也是如此。有人知道为什么会这样吗?非常感谢您的帮助。
提前致谢。
似乎 Chrome 认为仅使用 HTTP/HTTPS URL 重定向是安全的。我发现解决这个问题的唯一方法是创建一个基于 Personal access token method.
的登录表单