diff --git a/oauth3.core.js b/oauth3.core.js index 73015a2..e5a7dbb 100644 --- a/oauth3.core.js +++ b/oauth3.core.js @@ -969,7 +969,7 @@ } , api: function (providerUri, opts) { if (!OAUTH3.api[opts.api]) { - throw new Error("No API for '" + providerUri + "'"); + return OAUTH3.PromiseA.reject(new Error("No API for '" + providerUri + "'")); } return OAUTH3.api[opts.api](providerUri, opts); @@ -1073,7 +1073,7 @@ opts = opts || {}; opts.api = api; opts.session = OAUTH3.hooks.session._getCached(this._providerUri); - OAUTH3.api(this._providerUri, opts); + return OAUTH3.api(this._providerUri, opts); } }; result.authenticate = result.login;