MCPcopy Create free account
hub / github.com/Datakitpage/Datakit / getAuthStatus

Method getAuthStatus

backend/api/src/auth/auth.controller.ts:100–131  ·  view source on GitHub ↗
(@Request() req)

Source from the content-addressed store, hash-verified

98 @Get('status')
99 @HttpCode(HttpStatus.OK)
100 async getAuthStatus(@Request() req) {
101 try {
102 // Check for access token in cookies
103 const accessToken = req.cookies?.access_token;
104 const refreshToken = req.cookies?.refresh_token;
105
106 if (!accessToken && !refreshToken) {
107 return { authenticated: false };
108 }
109
110 // If we have access token, try to verify it
111 if (accessToken) {
112 try {
113 this.authService.verifyAccessToken(accessToken);
114 return { authenticated: true };
115 } catch {
116 // Access token invalid, check refresh token
117 }
118 }
119
120 // If we only have refresh token, check if it's valid
121 if (refreshToken) {
122 const isValid =
123 await this.authService.isRefreshTokenValid(refreshToken);
124 return { authenticated: isValid };
125 }
126
127 return { authenticated: false };
128 } catch (error) {
129 return { authenticated: false };
130 }
131 }
132
133 @Post('refresh')
134 @HttpCode(HttpStatus.OK)

Callers

nothing calls this directly

Calls 2

isRefreshTokenValidMethod · 0.80
verifyAccessTokenMethod · 0.45

Tested by

no test coverage detected