This content originally appeared on DEV Community and was authored by rorykilpatrick
The following code is in angular 13 and i need it to work in angular 9 but "HttpContext, HttpContextToken" aren't available does anyone know how to do in angular 9 ?
`import {InjectionToken} from "@angular/core";
import {Observable} from "rxjs";
import {AuthConfig} from "angular-oauth2-oidc";
import {HttpContext, HttpContextToken} from '@angular/common/http';
export enum JWTHeaderEnum {
NONE,
JWT,
AUTHORIZATION,
}
export const AUTH_TOKEN_HEADER = new HttpContextToken(() => JWTHeaderEnum.JWT);
export const HTTPCONTEXT_KONG_ENDPOINT = new HttpContext().set(AUTH_TOKEN_HEADER, JWTHeaderEnum.AUTHORIZATION);
export const HTTPCONTEXT_APIGEE_ENDPOINT = new HttpContext().set(AUTH_TOKEN_HEADER, JWTHeaderEnum.JWT);
export const HTTPCONTEXT_NO_AUTH = new HttpContext().set(AUTH_TOKEN_HEADER, JWTHeaderEnum.NONE);
`
This content originally appeared on DEV Community and was authored by rorykilpatrick
rorykilpatrick | Sciencx (2024-10-07T01:04:48+00:00) This code is in angular 13 what is the equivalent in angular 9. Retrieved from https://www.scien.cx/2024/10/07/this-code-is-in-angular-13-what-is-the-equivalent-in-angular-9/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.