MCPcopy Index your code
hub / github.com/diffgram/diffgram / get_decoded_access_token_from_session

Function get_decoded_access_token_from_session

shared/helpers/permissions.py:96–113  ·  view source on GitHub ↗

Gets the JWT from the client cookie. :return: String representing the ID token

()

Source from the content-addressed store, hash-verified

94
95
96def get_decoded_access_token_from_session() -> str or None:
97 """
98 Gets the JWT from the client cookie.
99 :return: String representing the ID token
100 """
101 oidc = OAuth2Provider()
102 oidc_client = oidc.get_client()
103 access_token = login_session.get('access_token')
104 if type(access_token) == str:
105 return access_token
106 if access_token is None:
107 return None
108 token_string = gzip.decompress(access_token).decode()
109 expired = oidc_client.id_token_has_expired(id_token = token_string)
110 if expired:
111 token_string = try_refreshing_tokens()
112
113 return token_string
114
115
116def try_refreshing_tokens() -> str or None:

Callers

nothing calls this directly

Calls 5

get_clientMethod · 0.95
OAuth2ProviderClass · 0.90
try_refreshing_tokensFunction · 0.85
id_token_has_expiredMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected