You can take a look at following flow to have an overview of Requests and Responses that Angular 11 Client will make or receive.
For more detail, please visit:
Angular + Spring Boot: JWT Authentication & Authorization example
Angular + Node.js Express: JWT Authentication & Authorization example
Open app/_helpers/auth.interceptor.js
, modify the code to work with x-access-token like this:
...
// const TOKEN_HEADER_KEY = 'Authorization'; // for Spring Boot back-end
const TOKEN_HEADER_KEY = 'x-access-token'; // for Node.js Express back-end
@Injectable()
export class AuthInterceptor implements HttpInterceptor {
...
private addTokenHeader(request: HttpRequest<any>, token: string) {
/* for Spring Boot back-end */
// return request.clone({ headers: request.headers.set(TOKEN_HEADER_KEY, 'Bearer ' + token) });
/* for Node.js Express back-end */
return request.clone({ headers: request.headers.set(TOKEN_HEADER_KEY, token) });
}
}
...
Run ng serve --port 8081
for a dev server. Navigate to http://localhost:8081/
.
Fullstack with Node.js Express:
Angular 11 + Node.js Express: JWT Authentication & Authorization example
Fullstack with Spring Boot:
Angular 11 + Spring Boot: JWT Authentication & Authorization example
Fullstack with Django:
Serverless with Firebase:
Integration (run back-end & front-end on same server/port)