Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions harvest-finance/backend/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ export class AuthController {
status: 401,
description: 'Invalid or expired refresh token',
})
@ApiResponse({
status: 400,
description: 'Validation error — refresh_token field is missing or malformed',
})
async refresh(
@Body() refreshTokenDto: RefreshTokenDto,
): Promise<TokenResponseDto> {
Expand Down
1 change: 1 addition & 0 deletions harvest-finance/backend/src/auth/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ describe('AuthService', () => {

expect(result).toHaveProperty('access_token');
expect(result.access_token).toBe('new_access_token');
expect(result).toHaveProperty('token_type', 'Bearer');
});
});

Expand Down
2 changes: 1 addition & 1 deletion harvest-finance/backend/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class AuthService {
},
);

return { access_token: accessToken };
return { access_token: accessToken, token_type: 'Bearer' };
} catch (error) {
throw new UnauthorizedException('Invalid or expired refresh token');
}
Expand Down
9 changes: 8 additions & 1 deletion harvest-finance/backend/src/auth/dto/auth-response.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,16 @@ export class TokenResponseDto {
/** Freshly issued short-lived JWT access token. */
@ApiProperty({
example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
description: 'Access token (JWT)',
description: 'JWT access token to be sent as a Bearer token in the Authorization header',
})
access_token: string;

/** OAuth 2.0 token type. Always "Bearer" for this API. */
@ApiProperty({
example: 'Bearer',
description: 'Token type — always "Bearer". Prefix the access_token with this value in the Authorization header.',
})
token_type: string;
}

/** Response shape returned after a successful logout. */
Expand Down
Loading