@navigraph/auth
Advanced tools
Comparing version 0.0.0-next-20221029200655 to 0.0.0-next-20221029204353
@@ -453,3 +453,3 @@ "use strict"; | ||
var import_axios3 = __toESM(require("axios")); | ||
var MAX_ATTEMPTS = 12; | ||
var MAX_ATTEMPTS = 60; | ||
function signInWithDeviceFlow(callback) { | ||
@@ -480,4 +480,6 @@ return _signInWithDeviceFlow.apply(this, arguments); | ||
} | ||
}).catch(function() { | ||
return new Error("Unable to sign in with device flow."); | ||
}).catch(function(err) { | ||
var ref; | ||
var status = (ref = err.response) === null || ref === void 0 ? void 0 : ref.status; | ||
return status && status < 500 ? new import_app5.InvalidClientError() : new Error("Unable to sign in with device flow. ".concat(err.message)); | ||
}) | ||
@@ -586,4 +588,6 @@ ]; | ||
throw new import_app5.DeviceFlowTokenExpiredError(); | ||
case "invalid_scope": | ||
throw new import_app5.InvalidScopeError(); | ||
default: | ||
throw error; | ||
throw new Error("An unknown error ocurred: " + error); | ||
} | ||
@@ -590,0 +594,0 @@ } else { |
@@ -57,2 +57,8 @@ import * as axios from 'axios'; | ||
* | ||
* @throws {@link NotInitializedError} - If the SDK is not initialized. | ||
* @throws {@link InvalidClientError} - If the client id or secret is invalid. | ||
* @throws {@link InvalidScopeError} - If the client contains one or several invalid scopes. | ||
* @throws {@link UserDeniedAccessError} - If the user denied access. | ||
* @throws {@link DeviceFlowTokenExpiredError} - If the user failed to authenticate within 5 mins. | ||
* | ||
* @async | ||
@@ -59,0 +65,0 @@ * @returns {Promise<User>} A promise that resolves with the user object. |
@@ -385,5 +385,5 @@ // src/api.ts | ||
import pkce from "@navigraph/pkce"; | ||
import { getApp as getApp3, NotInitializedError, UserDeniedAccessError, DeviceFlowTokenExpiredError } from "@navigraph/app"; | ||
import { getApp as getApp3, NotInitializedError, UserDeniedAccessError, DeviceFlowTokenExpiredError, InvalidClientError, InvalidScopeError } from "@navigraph/app"; | ||
import axios3 from "axios"; | ||
var MAX_ATTEMPTS = 12; | ||
var MAX_ATTEMPTS = 60; | ||
function signInWithDeviceFlow(callback) { | ||
@@ -414,4 +414,6 @@ return _signInWithDeviceFlow.apply(this, arguments); | ||
} | ||
}).catch(function() { | ||
return new Error("Unable to sign in with device flow."); | ||
}).catch(function(err) { | ||
var ref; | ||
var status = (ref = err.response) === null || ref === void 0 ? void 0 : ref.status; | ||
return status && status < 500 ? new InvalidClientError() : new Error("Unable to sign in with device flow. ".concat(err.message)); | ||
}) | ||
@@ -520,4 +522,6 @@ ]; | ||
throw new DeviceFlowTokenExpiredError(); | ||
case "invalid_scope": | ||
throw new InvalidScopeError(); | ||
default: | ||
throw error; | ||
throw new Error("An unknown error ocurred: " + error); | ||
} | ||
@@ -524,0 +528,0 @@ } else { |
{ | ||
"name": "@navigraph/auth", | ||
"version": "0.0.0-next-20221029200655", | ||
"version": "0.0.0-next-20221029204353", | ||
"license": "MIT", | ||
@@ -43,3 +43,3 @@ "description": "Authentication with Navigraph services as part of the Navigraph SDK", | ||
"@navigraph/pkce": "^1.0.3", | ||
"@navigraph/app": "0.0.0-next-20221029200655", | ||
"@navigraph/app": "0.0.0-next-20221029204353", | ||
"axios": "^0.24.0" | ||
@@ -46,0 +46,0 @@ }, |
50538
1353
+ Added@navigraph/app@0.0.0-next-20221029204353(transitive)
- Removed@navigraph/app@0.0.0-next-20221029200655(transitive)