yasudacloud / strapi-plugin-sso

MIT License
67 stars 48 forks source link

When you sign in successfully it redirects you to a hardcoded `/admin` url #18

Closed joaquinodz closed 9 months ago

joaquinodz commented 9 months ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch strapi-plugin-sso@0.2.1 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/strapi-plugin-sso/server/services/oauth.js b/node_modules/strapi-plugin-sso/server/services/oauth.js
index 3a78f85..36490bc 100644
--- a/node_modules/strapi-plugin-sso/server/services/oauth.js
+++ b/node_modules/strapi-plugin-sso/server/services/oauth.js
@@ -77,7 +77,7 @@ module.exports = ({strapi}) => ({
  window.addEventListener('load', function() {
    sessionStorage.setItem('jwtToken', '"${jwtToken}"');
    sessionStorage.setItem('userInfo', '${JSON.stringify(user)}');
-   location.href = '/admin'
+   location.href = '${strapi.config.admin.url}'
  })
 </script>
 </head>

This issue body was partially generated by patch-package.

yasudacloud commented 9 months ago

@joaquinodz Hi!πŸ˜„

The points you raised were very clear and appreciated.

You mean config/admin.js settings. Just to be sure, we have verified the operation with version 4.0.0 and the latest 4.12.1 and confirmed that there is no problem.

We will publish this change soon. Thank you sincerely!

yasudacloud commented 9 months ago

@joaquinodz I believe the problem has been resolved in v0.2.2, so I will close it. Thanks! 🍺

https://github.com/yasudacloud/strapi-plugin-sso/pull/19