Labs64 / PluginPass

PluginPass - WordPress PRO Plugin/Theme Licensing
https://wordpress.org/plugins/pluginpass-pro-plugintheme-licensing/
13 stars 1 forks source link

New Host/Licensee validation fails with HTTP400 - Licensee does not exist #19

Closed r-brown closed 5 years ago

r-brown commented 5 years ago

Attempt to validate new Licensee fails with the message:

Fatal error: Uncaught NetLicensing\RestException: [0]: Unsupported response status code 400: Licensee with the number 'localhost' does not exist. thrown in /var/www/html/wp-content/plugins/pluginpass/vendor/labs64/netlicensingclient-php/service/NetLicensingService.php on line 169

The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.

which is related to the Token Creation: request

POST https://go.netlicensing.io/core/v2/rest/token
tokenType=SHOP&licenseeNumber=localhost&successURL=Acquire+licenses

response

400
Content-Type: application/json
{"Signature":null,"infos":{"info":[{"value":"Licensee with the number 'localhost' does not exist.","id":"NotFoundException","type":"ERROR"}]},"items":null,"id":null,"ttl":null}
r-brown commented 5 years ago

TODO: verify, that new Licensees can be auto-created upon first validation, so further methods calls won't cause such errors.

r-brown commented 5 years ago

TODO: add consent verification before token get request

v-rudkovskiy commented 5 years ago

The problem is that we use the API licensee role to validate and create the token. If we want to make sure that Licensee can be created automatically, we need to get the product (check licensee auto-create property) and get the licensee (check if it exists), but the role "licensee" doesn't have these rights (throw 403 Access Denied ).

r-brown commented 5 years ago

As discussed all NLIC requests should be avoided without given user consent; e.g.

PluginPass used (developer) should be able to handle this case by requesting user consent; see also #13

Please also update:

r-brown commented 5 years ago

Following sample code https://github.com/Labs64/PluginPass/blob/master/examples/class-pluginpass-demo-settings.php#L95 return "No Consent" even after _setconsent() was called.

r-brown commented 5 years ago

@v-rudkovskiy please improve above sample, so this:

r-brown commented 5 years ago

Valid / not valid status mixed

image