简体   繁体   English

使用oidc-client和IdentityServer4在不同的域中登录

[英]SignIn with oidc-client and identityServer4 in different domain

I have a VueJs application in localhost that use the oidc-client.js library to do the login to an IdentityServer4 server in production, in another domain. 我在localhost中有一个VueJs应用程序,该应用程序使用oidc-client.js库登录到另一个域中生产环境中的IdentityServer4服务器。

After login, the IdentityServer redirects me to the VueJs app, than I call the method signinRedirectCallback() , but the oidc-client method getUser() does not give to me the user information. 登录后,IdentityServer将我重定向到VueJs应用程序,而不是我调用方法signinRedirectCallback() ,但oidc-client方法getUser()并没有向我提供用户信息。

If I check the LocalStorage I can see the oidc.user:IdentityServer4Url value where I can see all the information of the user (access_token, id_token, profile ecc...), and I've the Cookies 'idsrv', 'idsrv.session', 'ARRAffinity'. 如果我检查LocalStorage,则可以看到oidc.user:IdentityServer4Url值,在该值中可以看到用户的所有信息(access_token,id_token,配置文件ecc ...),并且还有Cookie的“ idsrv”,“ idsrv”。会话”,“ ARRAffinity”。

If I try the application in the same domain, it works. 如果我在同一个域中尝试该应用程序,它将起作用。 Is it possible to have a localhost app and do the login to another domain? 是否可以有一个本地主机应用程序并登录到另一个域? Thanks 谢谢

you can absolutely have your Identity server in a different domain and pretty much most of the big IDP's (Identity Provider) will live in a different domain. 您绝对可以将您的身份服务器放在不同的域中,并且几乎所有的大型IDP(身份提供者)都将位于不同的域中。

When you said, you have information on the local storage, did u make sure, the access token is the same as the one you have received in the singin response url? 当您说时,您具有本地存储上的信息,您是否确定访问令牌与您在singin响应URL中收到的令牌相同? in the local storage you would see a property called "expires_at" I guess, see if that value is valid. 在本地存储中,您会看到一个名为“ expires_at”的属性,请查看该值是否有效。

https://github.com/IdentityModel/oidc-client-js/blob/dev/src/UserManager.js#L595 https://github.com/IdentityModel/oidc-client-js/blob/dev/src/UserManager.js#L595

If all things are right, I can't think of any other reason why it should not retrieve. 如果所有的事情都正确的话,那么我就不会想到它不应该检索的任何其他原因。

One other debug technique which could help you is? 另一种可以帮助您的调试技术是? Go to your node_modules folder, look for oidc-cient-js folder, and modify the main property in package.json file from oidc-client.min.js to oidc-client.js, this way you can keep breakpoint and debug step by step and find out what is going on. 转到您的node_modules文件夹,查找oidc-cient-js文件夹,然后将package.json文件中的main属性从oidc-client.min.js修改为oidc-client.js,这样您就可以保持断点并逐步调试一步,找出正在发生的事情。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过oidc-client登录IdentityServer4时出现InvalidOperationException - InvalidOperationException when signing in to IdentityServer4 via oidc-client Identityserver4 / oidc将登录名发送到错误的域名 - Identityserver4/oidc sends the login to the incorrect domain name 从 OIDC 客户端注销不使用 IdentityServer4 - Sign out from OIDC client not working with IdentityServer4 负载测试IdentityServer4给出异常:插入后尝试请求signin-oidc路由时相关性失败 - Load testing IdentityServer4 gives Exception: Correlation failed when trying to request signin-oidc route after sing in IdentityServer4 使用带有 API 的客户端凭据工作流(或尝试模拟 OIDC 调用) - IdentityServer4 Using Client Credential Workflow with an API (Or trying to emulate OIDC calls) 自定义 IdentityServer4 完成登录视图或消息 - Customize IdentityServer4 Completing SignIn View or Message IdentityServer4-根据client_id使用不同的用户存储 - IdentityServer4 - Use different user stores based on client_id GetDiscoveryDocumentAsync 失败,IdentityServer4 客户端 - GetDiscoveryDocumentAsync failed, IdentityServer4 client 结合IdentityServer4和MVC客户端 - Combine IdentityServer4 and MVC client 使用 IdentityServer4 保护胖客户端 - Securing thick client with IdentityServer4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM