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 }
);

} }

相关内容

热门资讯

第八分钟指南!wepoker私... 第八分钟指南!wepoker私人局开挂视频(透视)其实真的有辅助开挂(哔哩哔哩)1、每一步都需要思考...
6分钟阶段!红龙poker辅助... 6分钟阶段!红龙poker辅助平台(透视)好像存在有辅助开挂(哔哩哔哩)1、红龙poker辅助平台透...
第4分钟攻略!wepoker高... 第4分钟攻略!wepoker高级辅助(透视)本来真的是有辅助开挂(哔哩哔哩)1、wepoker高级辅...
3分钟绝活!wepoker透视... 3分钟绝活!wepoker透视有用吗(透视)原来是有辅助脚本(哔哩哔哩)一、wepoker透视有用吗...
第7分钟妙计!wepoker黑... 第7分钟妙计!wepoker黑侠破解(透视)确实有辅助脚本(哔哩哔哩)1、下载好wepoker黑侠破...
第9分钟手筋!拱趴大菠萝十三水... 第9分钟手筋!拱趴大菠萝十三水作必弊(透视)其实存在有辅助神器(哔哩哔哩)1、完成拱趴大菠萝十三水作...
第四分钟大纲!wepoker可... 第四分钟大纲!wepoker可以透视码(透视)确实是有辅助插件(哔哩哔哩)进入游戏-大厅左侧-新手福...
三分钟学习!wepoker辅助... 三分钟学习!wepoker辅助脚本(透视)好像真的有辅助插件(哔哩哔哩)1、首先打开wepoker辅...
十分钟举措!红龙poker辅助... 十分钟举措!红龙poker辅助器免费观看(透视)本来真的有辅助下载(哔哩哔哩)1、首先打开红龙pok...
一分钟阶段!智星德州插件(透视... 一分钟阶段!智星德州插件(透视)原来真的是有辅助神器(哔哩哔哩)智星德州插件透视方法中分为三种模型:...