Coder Social home page Coder Social logo

hamza-webdev / angular-10-jwt-refresh-token Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bezkoder/angular-10-jwt-refresh-token

0.0 0.0 0.0 192 KB

Angular 10 Refresh Token example with JWT and Http Interceptor

JavaScript 4.79% TypeScript 72.96% CSS 3.42% HTML 18.83%

angular-10-jwt-refresh-token's Introduction

Angular 10 Refresh Token example with JWT and Http Interceptor

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

Angular JWT Refresh Token Flow

angular-10-refresh-token-jwt-interceptor-example

For more detail, please visit:

Angular 10 JWT Refresh Token example with Http Interceptor

Angular 10 JWT Authentication with Web API

Fullstack

Angular 10 + Spring Boot: JWT Authentication & Authorization example

Angular 10 + 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/.

More practice

Angular 10 CRUD application example with Web API

Angular 10 Pagination example | ngx-pagination

Angular 10 File Upload example with progress bar

Fullstack with Node.js Express:

Angular 10 + Node.js Express + MySQL

Angular 10 + Node.js Express + PostgreSQL

Angular 10 + Node.js Express + MongoDB

Fullstack with Spring Boot:

Angular 10 + Spring Boot + MySQL

Angular 10 + Spring Boot + PostgreSQL

Angular 10 + Spring Boot + MongoDB

Fullstack with Django:

Angular 10 + Django Rest Framework

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

How to Integrate Angular 10 with Node.js Restful Services

How to Integrate Angular with Spring Boot Rest API

angular-10-jwt-refresh-token's People

Contributors

tienbku avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.