# OAUTH2 基础 - 一场噩梦 :-(

**URL:** https://meta.discourse.org/t/oauth2-basic-a-nightmare/338662
**Category:** SSO
**Tags:** oauth2
**Created:** [2024年十一月27日 05:41 UTC](https://meta.discourse.org/t/oauth2-basic-a-nightmare/338662 "2024-11-27T05:41:00Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [2024年十一月29日 20:31 UTC](https://meta.discourse.org/t/oauth2-basic-a-nightmare/338662/10 "2024-11-29T20:31:29Z")

</div>

最简单的方法是从容器内部进行操作；您可以通过进入容器并运行以下命令来拦截和打印 nginx 和 Discourse 之间的请求：

```python
apt-get update && apt-get -y install scapy
scapy

# 在 scapy 提示符下，粘贴以下内容：
class Callback:
  def __init__ (self):
    self.last = None
  def prn(self, p):
    if p != self.last: # lo 上的 pcap 会捕获两次
      self.last = p
      p.hide_defaults()
      print(repr(p)) # 此行打印数据包，保留或删除它
      if scapy.packet.Raw in p.layers():
        try:
          print(p.load.decode())
        except:
          print(p.load)

sniff(filter="port 3000", iface="lo", prn=Callback().prn)

```

---

_[View the full topic](https://meta.discourse.org/t/oauth2-basic-a-nightmare/338662)._
