Skip to content

bezkoder/angular-12-jwt-refresh-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a427f19 · Aug 8, 2021

History

2 Commits
Aug 8, 2021
Aug 2, 2021
Aug 2, 2021
Aug 2, 2021
Aug 8, 2021
Aug 8, 2021
Aug 2, 2021
Aug 2, 2021
Aug 2, 2021
Aug 8, 2021
Aug 2, 2021
Aug 2, 2021
Aug 2, 2021

Repository files navigation

Angular 12 JWT Refresh Token example with Http Interceptor

You can take a look at following flow to have an overview of Requests and Responses that Angular 12 Client will make or receive.

Angular JWT Refresh Token Flow

angular-12-refresh-token-jwt-interceptor-example

For more detail, please visit:

Angular 12 JWT Refresh Token example with Http Interceptor

Angular 12 JWT Authentication & Authorization with Web API

Fullstack

Angular 12 + Spring Boot: JWT Authentication and Authorization example

Angular 12 + Node.js Express: JWT Authentication and 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/.

More practice

Angular CRUD Application example with Web API

Angular Pagination example | ngx-pagination

Angular File upload example with progress bar & Bootstrap

Fullstack with Node.js Express:

Angular + Node.js Express + MySQL example

Angular + Node.js Express + PostgreSQL example

Angular + Node.js Express + MongoDB example

Angular + Node.js Express: File upload example

Fullstack with Spring Boot:

Angular + Spring Boot + MySQL example

Angular + Spring Boot + PostgreSQL example

Angular + Spring Boot + MongoDB example

Angular + Spring Boot: File upload example

Fullstack with Django:

Angular 12 + Django example

Angular + Django + MySQL

Angular + Django + PostgreSQL

Angular + Django + MongoDB

Serverless with Firebase:

Angular 12 Firebase CRUD with Realtime DataBase | AngularFireDatabase

Angular 12 Firestore CRUD example with AngularFireStore

Angular 12 Firebase Storage: File Upload/Display/Delete example

Integration (run back-end & front-end on same server/port)

How to integrate Angular with Node.js Restful Services

How to Integrate Angular with Spring Boot Rest API