Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)
  • Hi
    Yes, if the JWT expires then the login expires. So I think the flow should go like this:

    Firstly, in the Simple JWT plugin settings on the Authentication tab let’s assume you have the default settings of:

    • JWT Time to Live = 60 (60 minutes until token expires)
    • Refresh Time to Love 20160 (20160 minutes (two weeks) during which a token can be refreshed)

    So when a user logs in, a JWT is created and stored in localstorage.

    Whenever there is a need to communicate with the database, first the app needs to check if the JWT is valid – you do this by sending it to the “Validate JWT URL” endpoint as shown on the same authentication tab in the plugin settings.

    If that JWT is valid (ie, it’s still within an hour of log in) then all good. If more than a hour has passed, and that validation therefore fails, the app must then attempt to refresh the JWT using the “Refresh JWT URL” endpoint in the same authentication tabe in the plugins settings. If the original JWT is less than 2 weeks old, then a new JWT will be returned which can be stored in localstorage and thus the user is persisted longer than the 60 minute TTL. All of this can happen in the background, the user needn’t do anything.

    If the JWT was more than 2 weeks old, the app will have to direct the user to log in again manually.

    I don’t think I can put a link here, but if you search youtube for “simple jwt plugin react” there is a video of the whole process in operation.

    Hope that helps!

    Hi ajfix
    How are you persisting users? Are you storing the JWT in local storage and refreshing it if it’s expired? As I recall, under the default setting the jwt expires quickly (60 mins) but can be refreshed for up to 2 weeks. That’s set using the “refresh time to live” setting. And the endpoint by that setting is the end point you use to refresh expired tokens. Is that any help?

    T

    Hi
    No documentation as yet, but the developer of the app is very quick at answering questions. What are you trying to do? Maybe some of us that have been using it can point you in the right direction…

    Thread Starter chantaspell

    (@chantaspell)

    Thanks @nicu_m that’s really helpful!
    It’s working as I want it to now!

    Thread Starter chantaspell

    (@chantaspell)

    Thanks @bcworkz, I’ll read up on pre_get_posts and see what I can figure out.

    Thread Starter chantaspell

    (@chantaspell)

    Hi thanks for taking the time to reply! Actually, I should have thought about putting it in an intermediate script server side…pretty dense of me!

    Cheers
    T

    Thread Starter chantaspell

    (@chantaspell)

    Thanks Darlio

    I will definitely have a look at that issue and keep my eye on things here.

    Many thanks!

    Thread Starter chantaspell

    (@chantaspell)

    Hi Thanks for your reply!

    Yes, I figured from the questions and issues raised on here that for many people the plugin is pretty self-explanatory! But after quite a while experimenting and reading up on authentication and wordpress I wasn’t really getting anywhere. I feel at home with JS and have plenty of experience with wordpress but don’t really know much at all about authentication. Yet.

    My end goal is a react app which uses headless wordpress as the backend. Ideally users will be able to login through react and create and have access to their own user-specific data which will be stored in the DB.

    I am looking forward to your How To for Android Apps, which may soon be useful on a diff project!

    Many thanks

    Thread Starter chantaspell

    (@chantaspell)

    Ah thank you! That’s perfect, and I learned something too. Despite what the previous poster said, I think getting stuck in and having a go is a good way to learn. Many thanks for your time.

    Thread Starter chantaspell

    (@chantaspell)

    Thanks @pixelbart!
    That takes away some of the errors, but it still gives the same message for this function:

    public function register_rml_scripts() {
            wp_register_script( 'rml-script', plugins_url( 'js/read-me-later.js', __FILE__ ), array('jquery'), null, true );
            wp_register_style( 'rml-style', plugin_dir_url( __FILE__ ) .'css/read-me-later.css' );
        }

    I’ve read the wp_register_script doc linked to from the link you gave me, but all seems to be fine (i tried changing the $in_footer param to false ).

    Any ideas?

    Thread Starter chantaspell

    (@chantaspell)

    Hi Thanks for the reply.

    Actually, I have just solved the problem. Basically (I should have been clearer.) yes, the inspection tool showed .login and .message, but I couldn’t tell what was actually setting the colour of that box. Nothing seemed to correspond to it (I’ll freely admit I’m no good at finding my way round Chrome inspection tool). Just going back to it now to explain my question a little more and I find what must have been staring me in the face for hours:

    `.login #login_error, .login .message {
    border-left: 4px solid #00a0d2;`

    You live and learn I guess. Should be pretty easy to slot into my plugin…I’ll worry about that tomorrow.

    Cheers!

    Thread Starter chantaspell

    (@chantaspell)

    Forgot I could attach a pic of what I’m talking about….would have been quicker!

    lost password page style

    Hi, I have/have had the exact same problems.

    1. Mobile friendly. I run two wordpress installations on one site (long story) both have twentyseventeen theme and both have same plugins. One wordpress installation passed the mobile friendly test, and the other didn’t. I find the culprit in the robots.txt file which referred to various WP folders that were only in the subfolder of the second installation. To cut a long story short, a new slimmed down robots.txt solved the problem and now whole site mobile friendly.

    2. Fetch and Render: I have the same problem as Rick1971. The image is all that gets fetched. I have tried turning off the infinity scrolling, but that didn’t help. Turning off static front page probably would help but I don’t want to do that. Am worried google won’t fetch any real content from my homepage…so guess I will have to try a new theme…unless anyone has a solution?

    I am having this problem in both chrome, opera, firefox and IE so its not a browser/theme issue (i tried changing theme)…had it on two blogs but now one has corrected itself (!) so maybe the other one will as well…let’s see

    chantaspell

    (@chantaspell)

    Hi!

    I am trying to put special characters in a slug so i can maintain an old url on a blog i am moving to wordpress.

    The old URL reads:

    www.mysite.com/wordpress/dogs+cats

    But when i put dogs+cats as a slug i end up with

    www.mysite.com/wordpress/dogscats

    as WP removes the plus sign. Is there a way around this?

Viewing 15 replies - 1 through 15 (of 16 total)