@PitaJ said in How to call API from client side.:
require(['api', 'translator'], (api, translator) => {
// Your code here
});
genius! and fast reply!
When I use the same command using unsecured HTTP, it's working, and the new user is added to NodeBB. But in HTTPS it doesn't. So, could it be a problem with your SSL certificate ?
Yes !! Thank you very much
(I'm thinking that it would be useful that the API-Write plugin sends a message "SSL is not activated" in that case, because we spend some time trying to understand that problem).
Yes, it's ok, and thank you for these information, and we would like SSL to be set up on the xxxxx.nodebb.com domain.
@Kowlin said:
@julian A good reminder, Lets Encrypt comes out in ~3 weeks.
Too bad our wildcard cert expires before then
Edit: Actually, I just checked again, it expires a month from now, but afaik Let's Encrypt won't issue Wildcards just yet, so I renewed anyway. Those bloodsuckers have gotten me for another year!
Now, when I'm just sending the following url from Chrome : https://xxxxxxx.nodebb.com/api/v1/users
I get the message
{"code":"upgrade-required","message":"HTTPS is required for requests to the write api, please re-send your request via HTTPS","params":{}}
I receive the same message with the precedent CURL command (given in the first post)
Thank you.
I did disable the option in the API-write module, and now it's working in a shell terminal when I send the above CURL command.
But when I try to use CURL in HTTPS within my PHP program,
I get this message (401) : A valid login session was not found. Please log in and try again.
I don't understand why I get this message, because :