Skip to content

Commit

Permalink
[@dhealthdapps/backend] fix(routes): remove query param for revoke en…
Browse files Browse the repository at this point in the history
…dpoint
  • Loading branch information
kravchenkodhealth committed Jan 13, 2023
1 parent 712ec1a commit 0a243ea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion runtime/backend/src/oauth/routes/OAuthController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ export class OAuthController {
protected async revoke(
@NestRequest() req: Request,
@Param("provider") provider: string,
@Query() query: OAuthCallbackRequest,
) {
// read and decode access token, then find account in database
const account: AccountDocument = await this.authService.getAccount(req);
Expand Down
2 changes: 1 addition & 1 deletion runtime/backend/src/oauth/services/OAuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class OAuthService {
}
// if scope not contains read_all - throw an exception
if (request && request.scope !== this.expectedScope) {
throw new HttpException(`Unauthorized`, 401);
throw new HttpException(`Forbidden`, 403);
}

// reads OAuth provider from configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ describe("common/OAuthController", () => {
.mockRejectedValue(expectedError);

// act
const result = (controller as any).callback(jest.fn(), "testProvider", {
scope: "read,activity:read_all",
});
const result = (controller as any).callback(
jest.fn(),
"testProvider",
jest.fn(),
);

// assert
expect(result).rejects.toThrowError(expectedError);
Expand Down

0 comments on commit 0a243ea

Please sign in to comment.