@orello/auth 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  interface OrelloAuthConfig {
2
+ appId: string;
2
3
  clientKey: string;
3
4
  clientSecret: string;
4
5
  redirectUri: string;
5
- scope?: string;
6
6
  state?: string;
7
7
  }
8
8
  export { OrelloAuthConfig };
@@ -1,10 +1,10 @@
1
1
  import { OrelloAuthConfig } from "../core/interfaces/config";
2
2
  declare class OrelloAuthProvider {
3
3
  baseUrl: string;
4
+ private appId;
4
5
  private clientKey;
5
6
  private clientSecret;
6
7
  private redirectUri;
7
- private scope;
8
8
  private state;
9
9
  constructor(options: OrelloAuthConfig);
10
10
  continueWithOrello(): Promise<string>;
@@ -12,19 +12,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  class OrelloAuthProvider {
13
13
  constructor(options) {
14
14
  this.baseUrl = "https://accounts.orello.space/o/oauth/auth";
15
+ if (!options.appId)
16
+ throw new Error("App ID was not provided.");
15
17
  if (!options.clientKey)
16
18
  throw new Error("Client Key was not provided.");
17
19
  if (!options.redirectUri)
18
20
  throw new Error("Redirect URI was not provided.");
21
+ this.appId = options.appId;
19
22
  this.clientKey = options.clientKey;
20
23
  this.clientSecret = options.clientSecret || "";
21
24
  this.redirectUri = options.redirectUri;
22
- this.scope = options.scope || "openid profile email";
23
25
  this.state = options.state || Math.random().toString(36).substring(7);
24
26
  }
25
27
  continueWithOrello() {
26
28
  return __awaiter(this, void 0, void 0, function* () {
27
- const url = `${this.baseUrl}?client_id=${this.clientKey}&redirect_uri=${encodeURIComponent(this.redirectUri)}&response_type=code&scope=${encodeURIComponent(this.scope)}&state=${this.state}`;
29
+ const url = `${this.baseUrl}?app_id=${this.appId}&client_id=${this.clientKey}&redirect_uri=${encodeURIComponent(this.redirectUri)}&response_type=code&state=${this.state}`;
28
30
  if (typeof window !== "undefined") {
29
31
  window.location.href = url;
30
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orello/auth",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": false,
5
5
  "description": "Authentication package for Orello.",
6
6
  "main": "dist/index.js",