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.
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;
}`
`
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.
Nicu,
Thank you for your prompt attention. We installed the fix and all is well.
Mike
-
This reply was modified 5 years ago by
mdraganza.
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.