Skip to content

Commit 912507a

Browse files
authored
fixed oauth authorize url generation (#76)
* fixed oauth authorize url generation * Revert "fixed oauth authorize url generation" This reverts commit 242d7d3. * fixed oauth authorize url generation
1 parent f0231d2 commit 912507a

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/api/oauth.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ export class OAuth {
6262
if (state) params["state"] = state;
6363
if (scope) params["scope"] = scope;
6464

65+
const baseURL = client.defaults.baseURL.replace("api.", "");
6566
const url = "/oauth/authorize";
66-
return client.getUri({ url, method: "GET", params });
67+
return client.getUri({ baseURL, url, method: "GET", params });
6768
}
6869

6970
/**

tests/api/oauth.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("OAuth", () => {
1717
const query = new URLSearchParams({ response_type, client_id, state });
1818

1919
expect(url).toBeDefined();
20-
expect(url).toBe(`${baseURL}/oauth/authorize?${query}`);
20+
expect(url).toBe(`${baseURL.replace("api.", "")}/oauth/authorize?${query}`);
2121
});
2222

2323
it("should generate an access token", async () => {

tests/webflow.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe("Webflow", () => {
105105
const query = new URLSearchParams({ response_type, client_id, state });
106106

107107
expect(url).toBeDefined();
108-
expect(url).toBe(`https://api.${options.host}/oauth/authorize?${query}`);
108+
expect(url).toBe(`https://${options.host}/oauth/authorize?${query}`);
109109
});
110110

111111
it("should generate an access token", async () => {

0 commit comments

Comments
 (0)