@faable/faable 1.5.17-next.24 → 1.5.17-next.26
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,18 +1,12 @@
|
|
|
1
|
-
import
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
subject_token: gh_token,
|
|
11
|
-
resource: "https://faable.com",
|
|
12
|
-
audience: "https://faable.com",
|
|
13
|
-
scope: "openid email profile",
|
|
4
|
+
const client = create_base_client();
|
|
5
|
+
const res = await client.post("/auth/github-oidc", {
|
|
6
|
+
token: gh_token
|
|
14
7
|
});
|
|
15
|
-
|
|
8
|
+
const { token, app_id } = res.data;
|
|
9
|
+
return { token, app_id };
|
|
16
10
|
};
|
|
17
11
|
const oidc_strategy = (config) => {
|
|
18
12
|
const { idToken } = config;
|
|
@@ -27,7 +21,7 @@ const oidc_strategy = (config) => {
|
|
|
27
21
|
token_ex = ex;
|
|
28
22
|
}
|
|
29
23
|
return {
|
|
30
|
-
Authorization: `Bearer ${token_ex.
|
|
24
|
+
Authorization: `Bearer ${token_ex.token}`,
|
|
31
25
|
};
|
|
32
26
|
},
|
|
33
27
|
app_id: async () => {
|
|
@@ -35,7 +29,7 @@ const oidc_strategy = (config) => {
|
|
|
35
29
|
const ex = await exchangeGithubOidcToken(idToken);
|
|
36
30
|
token_ex = ex;
|
|
37
31
|
}
|
|
38
|
-
return token_ex.
|
|
32
|
+
return token_ex.app_id;
|
|
39
33
|
}
|
|
40
34
|
};
|
|
41
35
|
};
|