From 22bc50b0ddc991408c4d792b2702cf8015168348 Mon Sep 17 00:00:00 2001 From: Mohammed Sohail Date: Thu, 28 Oct 2021 19:20:18 +0300 Subject: [PATCH] fix: allow fetch to send auth creds + dev testing --- README.md | 5 +++++ src/app/_services/auth.service.ts | 4 +++- src/environments/environment.dev.ts | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6048d66..18f369d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,11 @@ An angular admin web client for managing users and transactions in the CIC netwo This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.2.0. +## Node 17 Specific Dev Env + +In package.json:dependencies -> "cic-client-meta": "file:./tmp/cic-client-meta-0.0.7-alpha.6.tgz", +in package.json:scripts -> "start:dev": "export NODE_OPTIONS=--openssl-legacy-provider; ng serve -c dev", + ## Angular CLI Run `npm install -g @angular/cli` to install the angular CLI. diff --git a/src/app/_services/auth.service.ts b/src/app/_services/auth.service.ts index 9342b11..f506c02 100644 --- a/src/app/_services/auth.service.ts +++ b/src/app/_services/auth.service.ts @@ -81,7 +81,9 @@ export class AuthService { } getChallenge(): Promise { - return fetch(environment.cicMetaUrl).then((response) => { + return fetch(environment.cicMetaUrl, { + credentials: 'include', + }).then((response) => { if (response.status === 401) { const authHeader: string = response.headers.get('WWW-Authenticate'); return hobaParseChallengeHeader(authHeader); diff --git a/src/environments/environment.dev.ts b/src/environments/environment.dev.ts index 7a9ce94..975e5c2 100644 --- a/src/environments/environment.dev.ts +++ b/src/environments/environment.dev.ts @@ -6,7 +6,8 @@ export const environment = { logLevel: NgxLoggerLevel.DEBUG, serverLogLevel: NgxLoggerLevel.OFF, loggingUrl: '', - cicMetaUrl: 'https://meta-auth.dev.grassrootseconomics.net:443', + // This should match the cic-auth-helper + cicMetaUrl: 'http://127.0.0.1:5555', publicKeysUrl: 'https://dev.grassrootseconomics.net/.well-known/publickeys/', cicCacheUrl: 'https://cache.dev.grassrootseconomics.net', web3Provider: 'wss://bloxberg-ws.dev.grassrootseconomics.net',