Skip to content

Commit

Permalink
fixed oauth url generation (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
John Agan authored Nov 2, 2022
1 parent dd1cd89 commit 2cf97f7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion src/Webflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
7 changes: 4 additions & 3 deletions test/OAuth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand All @@ -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 () => {
Expand Down

0 comments on commit 2cf97f7

Please sign in to comment.