• Resolved mdraganza

    (@mdraganza)


    I’m using Simple-JWT-Login to redirect from our main web site to a WordPress FAQ site seamlessly without the user having to login to the FAQ site. This works great until we locked down the FAQ site with the Force Login plugin. Now the redirect fails. The token comes back as null. Will Simple-JWT-Login be made compatible with Force Login?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Nicu Micle

    (@nicu_m)

    Hello @mdraganza,

    If you use the autologin endpoint, it should be working, because the autologin generates a session, and the user is logged in.

    I will install the Force Login plugin and investigate and after that I will come back with updates.

    Best regards,
    Nicu.

    Thread Starter mdraganza

    (@mdraganza)

    Hi Nicu,
    Thanks for the reply. Here is more detail. The code is C#. The error message is “Only authenticated users can access the REST API.” with a 401 error. With Force Login deactive, I get back the token.

    			var url = $"{mysiteurl}?rest_route=/simple-jwt-login/v1/auth&email={username}&password={password}";
    			var client = _clientFactory.CreateClient();
    			var content = new FormUrlEncodedContent(new[]
    			{
    				new KeyValuePair<string, string>("", "")
    			});
    			// Call the Simple JWT plugin to get an auth token.
    			var response = await client.PostAsync(url, content);
    			string result = response.Content.ReadAsStringAsync().Result;
    			Token amosu = JsonConvert.DeserializeObject<Token>(result);
    //Redirect to my site with the token...
    
    

    public struct Token
    {
    public bool success;
    public DataResult data;
    }
    public struct DataResult
    {
    public string jwt;
    }`
    `

    Plugin Author Nicu Micle

    (@nicu_m)

    Hello @mdraganza,

    A new beta version for the plugin is available at: https://github.com/nicumicle/simple-jwt-login

    Now the plugin is compatible with the Force Login.

    Just clone the repository, create a zip file for the folder simple-jwt-login and upload it to your Website.

    In order to access your FAQ section, you need to go to the Simple JWT Login -> Login and check “Allow redirect to a specific URL if redirectUrl is present”.

    After that, just hit save and you should be able to auto-login to your FAQ section. Here is an example link:

    
    https://yoursite.com/?rest_route=/simple-jwt-login/v1/autologin&JWT={{YOUR_JWT_HERE}}&redirectUrl={{URL_TO_REDIRECT_AFTER_AUTOLOGIN}}
    

    PS: After I propper test the plugin, I will make a new release into the WordPress plugin directory.

    Best regards,
    Nicu.

    Thread Starter mdraganza

    (@mdraganza)

    Nicu,
    Thank you for your prompt attention. We installed the fix and all is well.

    Mike

    • This reply was modified 3 years, 9 months ago by mdraganza.
    Plugin Author Nicu Micle

    (@nicu_m)

    Hello @mdraganza,

    Thank you that you have tested the new plugin version and I’m glad that everything is working ok for you.

    Please don’t forget to rate this plugin and spread the word about it.

    Best regards,
    Nicu.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Force Login Compatibiltiy’ is closed to new replies.