I noticed the #502 issue, where the response was "maybe for next major version". Now ~half a year later and 9.0.0 has been released. Is this something that could be considered again? Many of the newer language features (used via Typescript or Babel) require promises to be effective (e.g. async/await).
If backwards compatibility is a concern, it would be possible to add a Promise based API in addition to the existing callback version. If the last parameter for callback is left out, all existing API's could instead return a promise:
webAuth.checkSession(options, (err, result) => {
if (err) return console.warn(err);
console.log(result);
});
webAuth.checkSession(options)
.then(result => console.log(result))
.catch(err => console.warn(err));
In our current Angular application we are wrapping calls to Auth0.js to return promises, and then having all API's we use in a Auth0Service. This because we use quite a bit of async/await code in our app. It would be great if we could remove the boilerplate and use Auth0.js directly.
Feel free to close this issue if it's still not on the agenda, but just thought I'd ask.
We had to push back new features for this new major version to address some issues, so it's a new major, but it is mostly compatible with the old one. For now, this is the API we'll maintain. I also like promises and async/await, but, since all our callbacks are "standard" callbacks (err, data), you can easily promisify our library and that's fine for now. We have a few plans for the SDKs that I can't comment now, but, moving forward, we'll be probably using promises and async/await ourselves.
Thanks for the info! Indeed there seems to be quite a bit of maintenance required for all of the SDK's Auth0 has for various languages and integrations. Trying to keep up with all the modern things in Javascript (es2015 modules, promises, async/await and more) is not easy. Still, sounds interesting, I'll keep an eye out in the future 馃槈
As of 2019 and https://github.com/auth0/auth0.js/issues/274 + this, would that be possible ?
it's possible but it's unlikely that we'll add this in the near/medium future. Our new sdk is based on promises, though. Check it out!
Most helpful comment
We had to push back new features for this new major version to address some issues, so it's a new major, but it is mostly compatible with the old one. For now, this is the API we'll maintain. I also like promises and async/await, but, since all our callbacks are "standard" callbacks (err, data), you can easily promisify our library and that's fine for now. We have a few plans for the SDKs that I can't comment now, but, moving forward, we'll be probably using promises and async/await ourselves.