Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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, 5 months ago by mdraganza.
    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;
    }`
    `

Viewing 2 replies - 1 through 2 (of 2 total)