public async isAuthenticated()

in src/script/management-sdk.ts [60:76]


    public async isAuthenticated(throwIfUnauthorized?: boolean): Promise<boolean> {
        let res: JsonResponse;
        let codePushError: CodePushError;

        try {
            res = await this._requestManager.get(urlEncode`/user`, false);
        } catch (error) {
            codePushError = error as CodePushError;
            if (codePushError && (codePushError.statusCode !== RequestManager.ERROR_UNAUTHORIZED || throwIfUnauthorized)) {
                throw codePushError;
            }
        }

        const authenticated: boolean = !!res && !!res.body;

        return authenticated;
    }