MCPcopy Index your code
hub / github.com/refined-github/refined-github / getTokenInfo

Function getTokenInfo

source/github-helpers/github-token.ts:102–114  ·  view source on GitHub ↗
(apiBase: string, personalToken: string)

Source from the content-addressed store, hash-verified

100};
101
102export async function getTokenInfo(apiBase: string, personalToken: string): Promise<TokenInfo> {
103 const {headers} = await baseApiFetch({apiBase, token: personalToken, path: ''});
104
105 const expiration = headers.get('GitHub-Authentication-Token-Expiration');
106 // Convert `2026-06-03 19:52:44 UTC` to `2026-06-03T19:52:44Z`
107 // So that `Date` constructor in Safari can parse it: #9043
108 const expirationTransformed = expiration?.replace(' ', 'T').replace(' UTC', 'Z');
109
110 return {
111 scopes: parseTokenScopes(headers),
112 expiration: expirationTransformed,
113 };
114}
115
116export async function expectTokenScope(scope: string): Promise<void> {
117 const token = await expectToken();

Callers 2

expectTokenScopeFunction · 0.85
validateTokenFunction · 0.85

Calls 4

baseApiFetchFunction · 0.85
parseTokenScopesFunction · 0.85
getMethod · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected