Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Commit 011e835

Browse files
committed
Publish token_type at introspection endpoint.
1 parent e993048 commit 011e835

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/oidcop/oauth2/introspection.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ def _introspect(self, token, client_id, grant):
5151
"iss": _context.issuer,
5252
}
5353

54+
try:
55+
_token_type = token.token_type
56+
except AttributeError:
57+
_token_type = None
58+
59+
if _token_type:
60+
ret["token_type"] = _token_type
61+
5462
if aud:
5563
ret["aud"] = aud
5664

tests/test_31_oauth2_introspection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,10 @@ def test_do_response(self):
325325
"iat",
326326
"scope",
327327
"aud",
328+
"token_type"
328329
}
329330
assert _payload["active"] is True
331+
assert _payload["token_type"] == "bearer"
330332

331333
def test_do_response_no_token(self):
332334
# access_token = self._get_access_token(AUTH_REQ)

0 commit comments

Comments
 (0)