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、不需要AI权限,帮...
揭秘!hhpoker有没有作弊... 揭秘!hhpoker有没有作弊辅助(辅助挂)一贯真的是有挂(有挂讲解辅助插件)1、点击下载安装,脚本...
传递经验!pokemmo内置修... 传递经验!pokemmo内置修改器(辅助挂)总是存在有挂(有挂透明挂辅助app);透视方法中分为三种...
每日必看!wepoker买钻石... 每日必看!wepoker买钻石有用吗(辅助挂)原来真的是有挂(有挂辅助辅助脚本)1、该软件可以轻松地...
揭秘几款!德普之星透视辅助插件... 揭秘几款!德普之星透视辅助插件(辅助挂)好像是有挂(有挂技巧辅助app)1、许多玩家不知道辅助怎么退...
每日必备!wepoker怎么破... 每日必备!wepoker怎么破解游戏(辅助挂)确实存在有挂(有人有挂辅助攻略)1、免费脚本咨询教程、...
实操分享!hardrock透视... 实操分享!hardrock透视工具(辅助挂)都是是真的有挂(的确有挂辅助攻略)1、透视辅助软件激活码...
揭秘几款!wepoker免费脚... 您好,这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】很多玩家在这款游戏中打...
分享开挂内幕!哈糖大菠萝有挂吗... 分享开挂内幕!哈糖大菠萝有挂吗5个常用方法(辅助挂)本来是真的有挂(有挂分享辅助技巧)1、实时透视辅...
2分钟细说!wepokerpl... 2分钟细说!wepokerplus透视脚本免费(辅助挂)真是真的有挂(有挂总结辅助软件)1、实时透视...