无效的redirect_uri:http:// localhost:5001/signin-oidc

问题描述:

我使用netcoreapp1.1框架IdentityServer4版本1.52开发了我的IdentityServer,它与控制台客户端的连接工作正常,但是使用MVC客户端netcoreapp2.0,在记录中显示我:无效的redirect_uri:http:// localhost:5001/signin-oidc

error: IdentityServer4.Validation.AuthorizeRequestValidator [0] Redirect_uri inválido: http://localhost:5001/signin-oidc --code omitted-- error: IdentityServer4.Endpoints.AuthorizeEndpoint [0] Request validation error 

我这样做,是在api acces hybrid但我仍然有同样的问题,对于我在mvc-hybrid了一个asp.net核心2应用程序的工作没有成功的客户端的步骤,突出的是AllowedRedirectUris参数为空。

fail: IdentityServer4.Validation.AuthorizeRequestValidator[0] Invalid redirect_uri: http://localhost:5001/signin-oidc { "ClientId": "client-hugo", "RedirectUri": "http://localhost:5001/signin-oidc", "AllowedRedirectUris": [], "SubjectId": "anonymous", "RequestedScopes": "", "Raw": { "client_id": "client-hugo", "redirect_uri": "http://localhost:5001/signin-oidc", "response_type": "code id_token", "scope": "openid profile email api-alumnos offline_access", "response_mode": "form_post", "nonce": "636412201009966900.ZDNmYjdmZWMtNWNlMS00ZDQyLWIxMjMtNWIzYTM4M2FhZmRhMmMxZGE2ZDUtM2M0MS00ZThiLTk4M2ItNDk2NGQ5YmZlODFj", "state": "CfDJ8J0brcCMivFPtUfbYRpOjISliA92IArZsJS1dmagQ9jYdvpmVj2ABROstPNhJyCWx8q4SntL6PXRubMgGqeUfdqWF0mNRAYifGy8OuEPZSQT295vWVfyN5gGhuvB6jQ043D14yUPLwkhS29IYfMoiliLQGatygTVnGMVJ7Bo-aV7FJcpHit-9b3RHRyaHiE0tToZdP8NxJInJ4vthIlXw1rgLjOmSqPxeN9KDfLgWrpki7XoBLkmV2K7px_GWp0ebaitkxnXTzDPg82M-nRJWfYLAXJ1nGvoZLD3GIXqFV22hDm0wmygbmRaMKezwZmHY12qr2pwa1N22aifJTZFzPY", "x-client-SKU": "ID_NET", "x-client-ver": "2.1.4.0" } } fail: IdentityServer4.Endpoints.AuthorizeEndpoint[0] Request validation failed 

你推荐我做什么?

+0

我知道认证的方式在asp.net核心2.0中发生了变化。由于您的客户端应用程序运行2.0,您可以尝试查看[mvc-hybrid示例的开发分支](https://github.com/IdentityServer/IdentityServer4.Samples/blob/dev/Clients/src/MvcHybrid/Startup的.cs)。它看起来已经更新为2.0。您的问题可能是由于在2.0应用程序中使用1.0样式身份验证。 – Peter

确保你的MVC客户端上http://localhost:5001

我*从http://localhost:5001/clientA将URL更改为http://localhost:5001在hosting.json文件上运行。否则,我需要使用UsePathBase中间件,因为它总是将路径添加到每个传入请求中,因此会混淆重定向URL。