You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I committed this change today so it should be included in the next release. I added the following to the docs which should cover how this has been supported:
IMPORTANT: When sending GET requests, by design, all information will be included in the URL of the request
This includes data as well as any credentials used to authenticate with the API. You have been warned.
This is unavoidable when sending requests in the JSONP format but, when using the JSON format, you can send POST
requests, which means that your data is sent inside the body of the request. Combine this with HTTPS and your data and
credentials cannot be sniffed over the network.
As you may have noticed; this method also accepts the following entirely optional options:
Option
Description
Default
format
Format in which requests are sent
"jsonp"
method
HTTP method to be used for requests
"GET"
// Does the same as specifying no options (i.e. using defaults)yourls.connect('https://example.com/yourls-api.php',null,{format: 'jsonp',method: 'GET'})// Best practice if you want to secure the data you're transmitting and you've setup CORS, if neededyourls.connect('https://example.com/yourls-api.php',{signature: '3002a61584'},{format: 'json',method: 'POST'})
The following formats are supported with the corresponding HTTP methods:
Format
HTTP Methods
json
GET, POST
jsonp
GET
IMPORTANT: The YOURLS server must be running version 1.5.1 or newer in order to send requests in the JSONP
format.
The new method signature for yourls.connect is as follows:
No description provided.
The text was updated successfully, but these errors were encountered: