[英]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.