diff --git a/package.json b/package.json index 9a210b62..53d92528 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "webflow-api", "description": "Webflow's official Node.js SDK for Data APIs", - "version": "1.0.2", + "version": "1.0.3", "types": "index.d.ts", "main": "dist/index.js", "contributors": [ diff --git a/src/Webflow.js b/src/Webflow.js index 0654ff06..fe191b50 100644 --- a/src/Webflow.js +++ b/src/Webflow.js @@ -265,7 +265,7 @@ export class Webflow { if (state) query.set("state", state); if (scope) query.set("scope", scope); - return `https://${this.host}/oauth/authorize?${query}`; + return `https://${this.client.host}/oauth/authorize?${query}`; } accessToken({ diff --git a/test/OAuth.test.js b/test/OAuth.test.js index 899b7dc1..400b238a 100644 --- a/test/OAuth.test.js +++ b/test/OAuth.test.js @@ -4,12 +4,13 @@ import { OAuthFixture } from "./OAuth.fixture"; import Webflow from "../src"; describe("OAuth", () => { + const host = "test.com"; let webflow; let api; beforeEach(() => { - api = nock("https://api.webflow.com"); - webflow = new Webflow({ token: "token" }); + api = nock(`https://api.${host}`); + webflow = new Webflow({ token: "token", host }); }); it("should generate an authorization url", () => { @@ -30,7 +31,7 @@ describe("OAuth", () => { }); expect(url).toBeDefined(); - expect(url).toBe(`https://${webflow.host}/oauth/authorize?${query}`); + expect(url).toBe(`https://${host}/oauth/authorize?${query}`); }); it("should generate an access token", async () => {