Angular 应用程序中的 Strapi Microsoft 身份验证存在重定向 URI 问题
Strapi Microsoft authentication having issue with Redirect URI in Angular app
我已遵循此 中详述的指南。一切都通过应用程序注册、Strapi 提供程序配置和 MSAL 配置进行设置。每当身份验证流程开始时,我都会被发送到 Microsoft 登录屏幕,我登录后收到 Microsoft 错误 AADSTS90102: 'redirect_uri' value must be a valid absolute URI.
。我目前在本地主机上 运行 Strapi 和 Angular。
我已将 http://localhost:1337/connect/microsoft/callback
添加到应用程序注册中的 Web 重定向 URI 列表中。错误屏幕 url 显示正在发送的重定向 URI。 redirect_uri=%2Fconnect%2Fmicrosoft%2Fcallback
。这似乎无效。
Strapi admin Microsoft 配置有一个字段显示 The redirect URL to add in your Microsoft application configurations
,其值 /connect/microsoft/callback
不可编辑。 auth 是否希望通过 uri?如果可以,如何改变?如果没有,配置它的正确方法是什么。我还没有找到任何关于如何配置它的官方文档。
url
in my-project/config/server.js
需要使用连接功能。但是文档不是很清楚
您可以像这样将 url
作为 http://localhost:1337
添加到 my-project/config/server.js
文件中:
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
admin: {
auth: {
secret: env('ADMIN_JWT_SECRET', '38506ed8f48446c253135d43bbc2afec'),
},
},
url: 'http://localhost:1337'
});
会在/connect/microsoft/callback
前加上http://localhost:1337
,应该可以解决这个问题。更多讨论 here and here.
此外,如果您的 localhost
之前由于某些其他配置而更改,您可以在此处添加特定主机和端口,如下所示:url: 'http://10.10.100.242:1337'
我已遵循此 AADSTS90102: 'redirect_uri' value must be a valid absolute URI.
。我目前在本地主机上 运行 Strapi 和 Angular。
我已将 http://localhost:1337/connect/microsoft/callback
添加到应用程序注册中的 Web 重定向 URI 列表中。错误屏幕 url 显示正在发送的重定向 URI。 redirect_uri=%2Fconnect%2Fmicrosoft%2Fcallback
。这似乎无效。
Strapi admin Microsoft 配置有一个字段显示 The redirect URL to add in your Microsoft application configurations
,其值 /connect/microsoft/callback
不可编辑。 auth 是否希望通过 uri?如果可以,如何改变?如果没有,配置它的正确方法是什么。我还没有找到任何关于如何配置它的官方文档。
url
in my-project/config/server.js
需要使用连接功能。但是文档不是很清楚
您可以像这样将 url
作为 http://localhost:1337
添加到 my-project/config/server.js
文件中:
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
admin: {
auth: {
secret: env('ADMIN_JWT_SECRET', '38506ed8f48446c253135d43bbc2afec'),
},
},
url: 'http://localhost:1337'
});
会在/connect/microsoft/callback
前加上http://localhost:1337
,应该可以解决这个问题。更多讨论 here and here.
此外,如果您的 localhost
之前由于某些其他配置而更改,您可以在此处添加特定主机和端口,如下所示:url: 'http://10.10.100.242:1337'