Skip to content

Commit 2cf97f7

Browse files
author
John Agan
authored
fixed oauth url generation (#68)
1 parent dd1cd89 commit 2cf97f7

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "webflow-api",
33
"description": "Webflow's official Node.js SDK for Data APIs",
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"types": "index.d.ts",
66
"main": "dist/index.js",
77
"contributors": [

src/Webflow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ export class Webflow {
265265
if (state) query.set("state", state);
266266
if (scope) query.set("scope", scope);
267267

268-
return `https://${this.host}/oauth/authorize?${query}`;
268+
return `https://${this.client.host}/oauth/authorize?${query}`;
269269
}
270270

271271
accessToken({

test/OAuth.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import { OAuthFixture } from "./OAuth.fixture";
44
import Webflow from "../src";
55

66
describe("OAuth", () => {
7+
const host = "test.com";
78
let webflow;
89
let api;
910

1011
beforeEach(() => {
11-
api = nock("https://api.webflow.com");
12-
webflow = new Webflow({ token: "token" });
12+
api = nock(`https://api.${host}`);
13+
webflow = new Webflow({ token: "token", host });
1314
});
1415

1516
it("should generate an authorization url", () => {
@@ -30,7 +31,7 @@ describe("OAuth", () => {
3031
});
3132

3233
expect(url).toBeDefined();
33-
expect(url).toBe(`https://${webflow.host}/oauth/authorize?${query}`);
34+
expect(url).toBe(`https://${host}/oauth/authorize?${query}`);
3435
});
3536

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

0 commit comments

Comments
 (0)