Nicu Micle
Forum Replies Created
-
hi @lion1991,
I believe the issue is due to the fact that you have not selected the payload key in plugin setting-> autologin (JWT parameter key). https://simplejwtlogin.com/docs/autologin/#screenshot
If you want to use the email from the payload, you need to write “email” or in case you want to authenticate by id, set “id” in this input.(without the double quotes)
Please let me know if this works for you.
Best regards,
Nicu
I’m glad that this helped you. If you have a moment, would you mind leaving a review? Your feedback is very important and helps us.
Thank you!
Best regards,
Nicu
Hello @razvanfrandes,
Thank you for reporting this issue. I will have a look and come back with details.
Best regards,
Nicu
Hi,
You might get this error because you have activated the option to check the JWT on all endpoints. ( Plugin settings General -> “All WordPress endpoints checks for JWT authentication”)
The WooCommerce sends the “Authorization” header, and that is not a JWT.
Can you please try to change the Simple-JWT-Login header from the default value “Authorization” to something else? For example “JWT”. (Simple-JWT-Login Plugin Settings-> General -> Get JWT token from -> Header)
https://simplejwtlogin.com/docs/#get-jwt-from-option
Also, please check if the “Protect endpoints” is activated. When this option is enabled, all the endpoints will require a JWT.(https://simplejwtlogin.com/docs/protect-endpoints/)
Please let me know if this works for you.
Best,
Nicu.
Hello,
Sorry for my late reply. I just managed to write the first article in the documentation with code examples.
You can check this link: https://simplejwtlogin.com/docs/code-examples/
Please let me know if this helps.
Best regards,
Nicu.
In order to generate a JWt, you can use one of the suggested libraries from https://jwt.io/libraries.
You just need to make sure when you generate the JWT, that you have in the payload the user email, or the user ID (based on the settings that you have set in WordPress settings) and that you sign the JWT with the same key.
If you app is written in PHP, i would recommend using the firebase JWT library. Here you can see an example on how to generate a jwt: https://github.com/firebase/php-jwt#example-encodedecode-headers
I will try to prepare a new blog post about this in the near future.
Meanwhile, if you still haven’t managed to create the JWT, just tell me please in what programming language your app is written, and I will try to write a small demo for you.
Hello @pynet,
In order to get the JWT, you can call the authentication endpoint with the user credentials.
In order to autologin, you just need to generate a link like:
https://your-site.com/?rest_route=/simple-jwt-login/v1/autologin&JWT=your-jwt-here
If the JWT is valid, and not expired, you will be automatically redirected to the WordPress dashboard.
Please let me know if this information was useful, or if you need any help.
Best regards,
Nicu.
Hi,
I’ve checked the plugin code, and it seems that this issue might come from the parse_url() function. It seems that the URL is malformed.
Can you please give more details about your website?
- Are you using the latest plugin version?
- Are you using apache/nginx?
- What PHP version are you using?
- Do you have this issue on a live website or on localhost?
Best regards,
Nicu.
Hi @pembo13 ,
Currently this is not possible. But it sounds like a nice idea.
I will have a look over this and come back to you.
Best regards,
Nicu.
Hello,
Do you send the password in the request body or as query params?
I would suggest to send it as request body. Then the special characters will not be encoded.
If you need to send the password in Query params, you can use the flag for base64 encoded password: https://simplejwtlogin.com/docs/authentication/#authentication-passwordpasshash-is-base64-encoded
Please let me know if this helps.
Best regards,
Nicu.
Hello,
I have good news. In order to prevent such errors, the plugin has now some pipelines that checks the compatibility with: PHP 5.5, PHP 5.6, PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0, PHP 8.1 and PHP 8.2.
The new plugin release will happen by the end of this week.
Thank you all for your help.
Best regards,
Nicu.
Thank you for checking @1benk1 !!!
Thanks for the headsup @1benk1.
I was testing on PHP 7.4.32 and there was working ok.
I’ve released a new version for the plugin
3.4.10
. Can you please test it and let me know if all is ok?Thanks.
Also, to make sure that it is an issue with the latest plugin version, can you please download version 3.4.8 from :https://downloads.www.ads-software.com/plugin/simple-jwt-login.3.4.8.zip ?
I’ve checked on my side, and I am unable to replicate the issue. I’ve tested on PHP 7.4.
This error it seems that it is triggered on the line when we call the
simple_jwt_login_before_endpoint
hook.Do You have a custom implementation for this hook?