@faable/faable 1.5.17-next.25 → 1.5.17-next.27

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,19 +1,12 @@
1
- import axios from 'axios';
1
+ import { create_base_client } from '../base_client.js';
2
2
 
3
- const auth = axios.create({
4
- baseURL: "https://faable.auth.staging.faable.link",
5
- });
6
3
  const exchangeGithubOidcToken = async (gh_token) => {
7
- const res = await auth.post("/oauth/token", {
8
- grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
9
- subject_token_type: "urn:ietf:params:oauth:token-type:jwt",
10
- subject_token: gh_token,
11
- resource: "https://faable.com",
12
- audience: "https://faable.com",
13
- scope: "openid email profile",
14
- client_id: "a6f1381a-2591-4f18-aaa4-b8922ac91fce"
4
+ const client = create_base_client();
5
+ const res = await client.post("/auth/github-oidc", {
6
+ token: gh_token
15
7
  });
16
- return res.data;
8
+ const { access_token, app_id } = res.data;
9
+ return { access_token, app_id };
17
10
  };
18
11
  const oidc_strategy = (config) => {
19
12
  const { idToken } = config;
@@ -36,7 +29,7 @@ const oidc_strategy = (config) => {
36
29
  const ex = await exchangeGithubOidcToken(idToken);
37
30
  token_ex = ex;
38
31
  }
39
- return token_ex.access_token;
32
+ return token_ex.app_id;
40
33
  }
41
34
  };
42
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/faable",
3
- "version": "1.5.17-next.25",
3
+ "version": "1.5.17-next.27",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Marc Pomar <marc@faable.com>",