Web tokens in Angular 2+

后端 未结 3 778
天涯浪人
天涯浪人 2020-12-11 11:02

I am sending a POST request to a back end REST API, via a login component. I get an x-auth token back in the response headers. How do I get and store this token so I can use

3条回答
  •  执笔经年
    2020-12-11 11:54

    Store the token you are receiving in the local storage of the web browser and use an http interceptor to remove the token from all responses and add the token to all requests.

提交回复
热议问题