Angular在请求时不发送httponlycookie
创始人
2024-10-30 20:30:53
0

通过设置withCredentials为true来发送HttpOnly Cookie。

下面是一个示例:

import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http';

@Injectable({ providedIn: 'root' }) export class ApiService {

private endpoint = 'https://example.com/api/';

constructor( private http: HttpClient ) {}

public getUser(token: string) { const headers = new HttpHeaders({ Authorization: Bearer ${token} });

return this.http.get(
  `${this.endpoint}user`,
  { withCredentials: true, headers }
);

} }

相关内容

热门资讯

透视挂!pokerworld破... 透视挂!pokerworld破解版下载(透视)微信西楚辅助(一贯是有辅助安装)-哔哩哔哩1、这是跨平...
透视能赢!hhpoker德州透... 透视能赢!hhpoker德州透视挂(透视)多乐辅助在哪里可以下载(其实是真的辅助修改器)-哔哩哔哩1...
透视ai代打!智星德州可以透视... 透视ai代打!智星德州可以透视吗(透视)四川游戏家园破解版ios(竟然真的是有辅助安装)-哔哩哔哩1...
现有说明如下!wepoker安... 现有说明如下!wepoker安装教程(透视)雀姬辅助工具(本来真的是有辅助插件)-哔哩哔哩1、雀姬辅...
透视好友!wepoker私人局... 透视好友!wepoker私人局规律(透视)福建天天开心万能辅助(好像真的是有辅助安装)-哔哩哔哩1、...
透视透视!来玩德州破解器(透视... 透视透视!来玩德州破解器(透视)宝宝浙江辅助脚本(一贯是真的辅助安装)-哔哩哔哩小薇(辅助器软件下载...
此事迅速冲上热搜!aapoke... 此事迅速冲上热搜!aapoker怎么提高中牌率(透视)心悦俱乐部游戏辅助(果然真的是有辅助平台)-哔...
突发!aapoker怎么开辅助... 突发!aapoker怎么开辅助器(透视)新上游辅助器(竟然是真的辅助工具)-哔哩哔哩1、完成新上游辅...
有消息称!wepoker私人局... 有消息称!wepoker私人局外卦(透视)广丰510k辅助(本来是有辅助插件)-哔哩哔哩1)广丰51...
截至发稿!购买wepoker模... 截至发稿!购买wepoker模拟器(透视)福州天天开心辅助(真是有辅助神器)-哔哩哔哩1、超多福利:...