identityserver4 报错无效的Invalid redirect_uri

使用https://github.com/skoruba/IdentityServer4.Admin的,移植ABP Vnext的identityserver4时。
客户端登录时报如下错误(原始的错误找不到了,这个是从网上找的):

identityserver4[2020-03-24] Invalid redirect_uri: http://***
fail: [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: [0] Request validation failed

解决方案:配置好客户端的返回地址,保证AllowedRedirectUris:中的值与Invalid redirect_uri: http://localhost:5001/signin-oidc,相同。

开始以为是identityserver4必须使用https的问题,还以为是IdentityServer4.Admin对URI有验证。

发布了181 篇原创文章 · 获赞 35 · 访问量 76万+

猜你喜欢

转载自blog.csdn.net/dacong/article/details/105081939