Use compute auth service and fix static code analyzer warnings (#15)
* Clean up formatting * Use new compute_auth service Implment SSO Implement token refresh Clean up unit tests * Fix unit tests * Fix auth test Fix warnings * Update default settings for compute_auth
This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
const AUTH_URL = process.env.REACT_APP_AUTH_SERVICE_URL || "https://dev-auth.fiskerdps.com";
|
||||
const AUTH_URL = process.env.REACT_APP_AUTH_SERVICE_URL || "https://gw-dev.fiskerdps.com/compute_auth";
|
||||
const CALLBACK_URL = process.env.REACT_APP_AUTH_CALLBACK_URL || "https://dev-ota-admin.fiskerdps.com";
|
||||
|
||||
const auth = {
|
||||
signIn: (username, password) => fetch(`${AUTH_URL}/auth/login`, {
|
||||
ssoAuthorize: () => `${AUTH_URL}/authorize?redirect=${CALLBACK_URL}`,
|
||||
ssoLogout: () => `${AUTH_URL}/logout?redirect=${CALLBACK_URL}`,
|
||||
signIn: (code) => fetch(`${AUTH_URL}/token`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username,
|
||||
password,
|
||||
code,
|
||||
redirect: CALLBACK_URL,
|
||||
})
|
||||
}).then((response) => response.json()),
|
||||
|
||||
signUp: (username, password) => fetch(`${AUTH_URL}/auth/register`, {
|
||||
verify: (idToken) => fetch(`${AUTH_URL}/verify`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username,
|
||||
password,
|
||||
})
|
||||
body: JSON.stringify({ token: idToken })
|
||||
}).then((response) => response.json()),
|
||||
|
||||
verify: (accessToken) => fetch(`${AUTH_URL}/auth/verify`, {
|
||||
refresh: (refreshToken) => fetch(`${AUTH_URL}/refresh`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({ token: accessToken })
|
||||
body: JSON.stringify({ refresh_token: refreshToken })
|
||||
}).then((response) => response.json()),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user