Closed sarthology closed 2 years ago
The issue fixed with strapi-plugin-passwordless@4.0.6
The issue was after update of version strapi, one of the services in user-permission plugin changed without clear reasons
This is the error I got.
@bc96123 first of all I suggest to check versions of the plugin and strapi (I tested it at strapi@v4.1.12 and strapi-plugin-passwordless@4.0.7), also as I can see the error can be if you try to get token for not registered username.
@bc96123 first of all I suggest to check versions of the plugin and strapi (I tested it at strapi@v4.1.12 and strapi-plugin-passwordless@4.0.7), also as I can see the error can be if you try to get token for not registered username.
My Project: OS: MacOS 12.3 Node: v16.15.0 Strapi: 4.1.11 Passwordless-Plugin: 4.0.6
Try to use the same service with email
POST /api/passwordless/send-link
{
"email": "your@email.com"
}
@kucherenko I got the same error message.
{
"data": null,
"error": {
"status": 400,
"name": "BadRequestError",
"message": "wrong.email",
"details": {}
}
}
could you please show me the passwordless config page?
I'm getting this error too, it used to work a month ago..not sure when or why it stopped working for me
here's my package.json:
"dependencies": {
"@strapi/icons": "0.0.1-alpha.79",
"@strapi/plugin-graphql": "^4.1.12",
"@strapi/plugin-i18n": "4.1.12",
"@strapi/plugin-users-permissions": "4.1.12",
"@strapi/provider-email-mailgun": "^4.1.12",
"@strapi/strapi": "4.1.12",
"form-data": "^4.0.0",
"jwt-decode": "^3.1.2",
"node-fetch": "^3.2.3",
"pg": "8.6.0",
"react-icons": "4.3.1",
"react-waypoint": "^10.1.0",
"request": "^2.88.2",
"strapi-plugin-passwordless": "^4.0.6",
"strapi-provider-upload-dos": "^4.0.5",
I tried strapi 4.2.2 and strapi-plugin-passwordless 4.0.8 - get the same error, just gives 400 error
could you please share the request and response details? how do you try to call the service?
I'll try to reproduce, sometimes developers of strapi make some changes, and the plugin becomes broken
thanks for the quick reply. I'm just trying in postman, and get wrong.user
:
I also tried adding it with {"data":
, and it says wrong email, instead of wrong.user
(above)
So, the second variant with "data" is wrong. The first variant should work. I've created a fresh strapi@4.2.2 installation and installed "strapi-plugin-passwordless": "^4.0.8" and it works. Could you please remove node_modules and install modules again? I can't reproduce the issue on blank installation, but probably the issue is somewhere else.
okay thanks a lot
I rolled back to an old commit, with the following versions ( strapi 4.1.7 and passwordless 4.0.5), and that worked fine..but when I use 4.2.2 and 4.0.8, i am getting the error.
I had extended the user-permissions extension, so maybe it is something I have done that is causing the error. THanks for checking with the fresh installations
"devDependencies": {},
"dependencies": {
"@_sh/strapi-plugin-ckeditor": "^1.1.0",
"@strapi/plugin-graphql": "^4.1.7",
"@strapi/plugin-i18n": "4.1.7",
"@strapi/plugin-users-permissions": "4.1.7",
"@strapi/provider-email-mailgun": "^4.1.7",
"@strapi/strapi": "4.1.7",
"form-data": "^4.0.0",
"jwt-decode": "^3.1.2",
"node-fetch": "^3.2.3",
"pg": "8.6.0",
"request": "^2.88.2",
"strapi-plugin-passwordless": "^4.0.5",
"strapi-provider-upload-dos": "^4.0.5"
},
thank you for the report, I'll observe the behavior and fix it in case of issues
Thanks, I've checked the changes between my old setup and new one, and I can't see anything that is too different
All the permissions are the same..but one environment passwordless works fine, the other it doesn't at all.
Can you think of anything obvious? This is the repo: https://github.com/Prototypr/prototypr-backend/tree/main/src/extensions/users-permissions - i suspect it could be user-permissions
extension, but it's pretty much the same as the original Strapi plugin
I have found my issue
This sanitizer removes the user.email
:
https://github.com/kucherenko/strapi-plugin-passwordless/blob/main/server/services/passwordless.js#L166
and because email is null, this check fails: https://github.com/kucherenko/strapi-plugin-passwordless/blob/main/server/controllers/auth.js#L107
If I return user before L166 on the passwordless.js, it works. I don't know why email is sanitized out for me, but that was the cause of my problem
will try to investigate sanitizers too
I put my change on that branch - I can send as a pull request if you think it is worthwhile
After enabling everything as mentioned in the Readme, it's not sending requests and showing the following error. How to debug this?