docs: Fix OAuth casing (#18066)
This commit is contained in:
1 parent
382f00e178
commit
8679d21d78
10 files changed
+15
-15
No files matched your search
@@ -113,7 +113,7 @@ describe("Platform Calendars Endpoints", () => {
|
||||
});
|
||||
|
||||
// TODO: Uncomment this once CI is ready to run proper Office365 tests
|
||||
// it(`/GET/v2/calendars/${OFFICE_365_CALENDAR}/connect: it should redirect to auth-url for office 365 calendar oauth with valid access token `, async () => {
|
||||
// it(`/GET/v2/calendars/${OFFICE_365_CALENDAR}/connect: it should redirect to auth-url for office 365 calendar OAuth with valid access token `, async () => {
|
||||
// const response = await request(app.getHttpServer())
|
||||
// .get(`/v2/calendars/${OFFICE_365_CALENDAR}/connect`)
|
||||
// .set("Authorization", `Bearer ${accessTokenSecret}`)
|
||||
@@ -123,7 +123,7 @@ describe("Platform Calendars Endpoints", () => {
|
||||
// expect(data.authUrl).toBeDefined();
|
||||
// });
|
||||
|
||||
it(`/GET/v2/calendars/${GOOGLE_CALENDAR}/connect: it should redirect to auth-url for google calendar oauth with valid access token `, async () => {
|
||||
it(`/GET/v2/calendars/${GOOGLE_CALENDAR}/connect: it should redirect to auth-url for google calendar OAuth with valid access token `, async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.get(`/v2/calendars/${GOOGLE_CALENDAR}/connect`)
|
||||
.set("Authorization", `Bearer ${accessTokenSecret}`)
|
||||
|
||||
@@ -4,6 +4,7 @@ import { AppsRepository } from "@/modules/apps/apps.repository";
|
||||
import { CredentialsRepository } from "@/modules/credentials/credentials.repository";
|
||||
import { SelectedCalendarsRepository } from "@/modules/selected-calendars/selected-calendars.repository";
|
||||
import { TokensRepository } from "@/modules/tokens/tokens.repository";
|
||||
import { calendar_v3 } from "@googleapis/calendar";
|
||||
import { Logger, NotFoundException } from "@nestjs/common";
|
||||
import { BadRequestException, UnauthorizedException } from "@nestjs/common";
|
||||
import { Injectable } from "@nestjs/common";
|
||||
@@ -11,7 +12,6 @@ import { ConfigService } from "@nestjs/config";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { Request } from "express";
|
||||
import { OAuth2Client } from "googleapis-common";
|
||||
import { calendar_v3 } from "@googleapis/calendar";
|
||||
import { z } from "zod";
|
||||
|
||||
import { SUCCESS_STATUS, GOOGLE_CALENDAR_TYPE } from "@calcom/platform-constants";
|
||||
@@ -91,7 +91,7 @@ export class GoogleCalendarService implements OAuthCalendarApp {
|
||||
}
|
||||
|
||||
if (gcalCredentials.invalid) {
|
||||
throw new BadRequestException("Invalid google oauth credentials.");
|
||||
throw new BadRequestException("Invalid google OAuth credentials.");
|
||||
}
|
||||
|
||||
const { connectedCalendars } = await this.calendarsService.getCalendars(userId);
|
||||
|
||||
@@ -95,7 +95,7 @@ describe("Platform Gcal Endpoints", () => {
|
||||
.expect(401);
|
||||
});
|
||||
|
||||
it(`/GET/gcal/oauth/auth-url: it should auth-url to google oauth with valid access token `, async () => {
|
||||
it(`/GET/gcal/oauth/auth-url: it should auth-url to google OAuth with valid access token `, async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.get(`/v2/gcal/oauth/auth-url`)
|
||||
.set("Authorization", `Bearer ${accessTokenSecret}`)
|
||||
@@ -105,7 +105,7 @@ describe("Platform Gcal Endpoints", () => {
|
||||
expect(data.authUrl).toBeDefined();
|
||||
});
|
||||
|
||||
it(`/GET/gcal/oauth/save: without oauth code`, async () => {
|
||||
it(`/GET/gcal/oauth/save: without OAuth code`, async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get(
|
||||
`/v2/gcal/oauth/save?state=accessToken=${accessTokenSecret}&origin%3D${CLIENT_REDIRECT_URI}&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events`
|
||||
|
||||
@@ -100,7 +100,7 @@ export class GcalController {
|
||||
}
|
||||
|
||||
if (gcalCredentials.invalid) {
|
||||
throw new BadRequestException("Invalid google oauth credentials.");
|
||||
throw new BadRequestException("Invalid google OAuth credentials.");
|
||||
}
|
||||
|
||||
const { connectedCalendars } = await this.calendarsService.getCalendars(userId);
|
||||
|
||||
@@ -102,7 +102,7 @@ describe("PermissionsGuard", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("when oauth id is provided", () => {
|
||||
describe("when OAuth id is provided", () => {
|
||||
it("should return true for valid permissions", async () => {
|
||||
const mockContext = createMockExecutionContext({ "x-cal-client-id": "100" });
|
||||
jest.spyOn(reflector, "get").mockReturnValue([SCHEDULE_WRITE]);
|
||||
|
||||
@@ -89,7 +89,7 @@ export class ConferencingController {
|
||||
@Get("/:app/oauth/auth-url")
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@UseGuards(ApiAuthGuard)
|
||||
@ApiOperation({ summary: "Get oauth conferencing app auth url" })
|
||||
@ApiOperation({ summary: "Get OAuth conferencing app auth url" })
|
||||
async redirect(
|
||||
@Req() req: Request,
|
||||
@Headers("Authorization") authorization: string,
|
||||
|
||||
+2
-2
@@ -244,7 +244,7 @@ describe("OAuth client WebhooksController (e2e)", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
it("/webhooks (GET) should fail to get webhooks of oauth client that doesn't belong to you", () => {
|
||||
it("/webhooks (GET) should fail to get webhooks of OAuth client that doesn't belong to you", () => {
|
||||
return request(app.getHttpServer()).get(`/v2/oauth-clients/${otherOAuthClient.id}/webhooks`).expect(403);
|
||||
});
|
||||
|
||||
@@ -267,7 +267,7 @@ describe("OAuth client WebhooksController (e2e)", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("/oauth-clients/:oAuthClientId/webhooks/:webhookId (DELETE) should fail to delete webhooks of an oauth client that doesn't belong to you", () => {
|
||||
it("/oauth-clients/:oAuthClientId/webhooks/:webhookId (DELETE) should fail to delete webhooks of an OAuth client that doesn't belong to you", () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/v2/oauth-clients/${otherOAuthClient.id}/webhooks/${otherOAuthClientWebhook.id}`)
|
||||
.expect(403);
|
||||
|
||||
@@ -3865,7 +3865,7 @@
|
||||
"/v2/conferencing/{app}/oauth/auth-url": {
|
||||
"get": {
|
||||
"operationId": "ConferencingController_redirect",
|
||||
"summary": "Get oauth conferencing app auth url",
|
||||
"summary": "Get OAuth conferencing app auth url",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
@@ -15367,4 +15367,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3665,7 +3665,7 @@
|
||||
"/v2/conferencing/{app}/oauth/auth-url": {
|
||||
"get": {
|
||||
"operationId": "ConferencingController_redirect",
|
||||
"summary": "Get oauth conferencing app auth url",
|
||||
"summary": "Get OAuth conferencing app auth url",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
|
||||
@@ -43,4 +43,4 @@ description: Answers to the most common questions about the Platform API and ato
|
||||
### 9. What are the authentification methods for making calls to the v2 API?
|
||||
Either of the two:
|
||||
- Setting `Authorization: Bearer <token>` header where `<token>` is access token of the managed user.
|
||||
- Setting `x-cal-client-id: <client-id>` and `x-cal-secret-key: <client-secret>` where `<client-id>` is oauth client id and `<client-secret>` is oauth client secret. Both can be copied from the dashboard.
|
||||
- Setting `x-cal-client-id: <client-id>` and `x-cal-secret-key: <client-secret>` where `<client-id>` is OAuth client id and `<client-secret>` is OAuth client secret. Both can be copied from the dashboard.
|
||||
Reference in new issue
Block a user