Skip to content

Commit

Permalink
feat(admin api): new /refresh api endpoint (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
authcompanion authored Oct 29, 2023
1 parent ec5576c commit 482ae8b
Show file tree
Hide file tree
Showing 51 changed files with 1,033 additions and 503 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ node_modules
serverkey
adminkey
.DS_Store
.vscode
.idea
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.github
.vscode
documentation/.vitepress
adminkey
CHANGELOG.md
LICSENSE.md
package-lock.json
package.json
pnpm-lock.yaml
serverkey
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ With AuthC you can:
- Manage Users via a self-service Dashboard and confidently store and own your web application's user accounts, on your terms.
- Help users create accounts and login with a passkey on their mobile device (aka passwordless) or by using traditional username/passwords instead.


| Login Screen | Registration Screen |
| :----------------------------------: | :----------------------------------------: |
| ![Login](./.github/public/login.png) | ![Register](./.github/public/register.png) |
Expand Down Expand Up @@ -76,6 +75,7 @@ Start the server (with the default config):
```bash
$ docker run -it -p 3002:3002 --name AuthCompanion ghcr.io/authcompanion/authcompanion2:main
```

Also available is the [docker-compose.yml](https://github.com/authcompanion/authcompanion2/blob/main/docker-compose.yml)

### Configure AuthCompanion
Expand Down
4 changes: 2 additions & 2 deletions client/admin/dashboardPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ <h1 class="text-2xl font-bold text-gray-900 sm:text-3xl">
"Content-type": "application/json",
Authorization: `Bearer ${token}`,
},
}
},
);
const data = await response.json();
// If the response is not ok, throw an error
Expand All @@ -922,7 +922,7 @@ <h1 class="text-2xl font-bold text-gray-900 sm:text-3xl">

// Call the showNotificationMessage function to show a success message
showNotificationMessage(
`Found ${users.value.data.length} user(s) matching the search.`
`Found ${users.value.data.length} user(s) matching the search.`,
);
} catch (e) {
console.log("Search User Failed");
Expand Down
2 changes: 1 addition & 1 deletion client/admin/loginAdminPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
if (response.ok) {
window.localStorage.setItem(
"ACCESS_TOKEN",
resbody.data.attributes.access_token
resbody.data.attributes.access_token,
);

window.location.href = appOrigin;
Expand Down
6 changes: 3 additions & 3 deletions client/auth/loginPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
if (response.ok) {
window.localStorage.setItem(
"ACCESS_TOKEN",
resbody.data.attributes.access_token
resbody.data.attributes.access_token,
);

window.location.href = appOrigin;
Expand Down Expand Up @@ -318,15 +318,15 @@
"content-type": "application/json",
"x-authc-app-challenge": opts.challenge,
},
}
},
);
const reply = await verificationResponse.json();
const appOrigin =
await verificationResponse.headers.get("x-authc-app-origin");

window.localStorage.setItem(
"ACCESS_TOKEN",
reply.data.attributes.access_token
reply.data.attributes.access_token,
);
showError.value = false;
window.location.href = appOrigin;
Expand Down
4 changes: 2 additions & 2 deletions client/auth/profilePage.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@
const refreshBody = await refreshResponse.json();
window.localStorage.setItem(
"ACCESS_TOKEN",
refreshBody.data.attributes.access_token
refreshBody.data.attributes.access_token,
);
const updatedResponse = await updateUser();

Expand All @@ -357,7 +357,7 @@
} else if (response.ok) {
window.localStorage.setItem(
"ACCESS_TOKEN",
webserviceResponse.data.attributes.access_token
webserviceResponse.data.attributes.access_token,
);
showError.value = true;
errorTitle.value = "Success";
Expand Down
8 changes: 4 additions & 4 deletions client/auth/registrationPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
if (response.ok) {
window.localStorage.setItem(
"ACCESS_TOKEN",
resbody.data.attributes.access_token
resbody.data.attributes.access_token,
);
showError.value = false;

Expand Down Expand Up @@ -354,7 +354,7 @@
headers: {
"content-type": "application/json",
},
}
},
);

if (optionsResponse.ok) {
Expand All @@ -371,15 +371,15 @@
"content-type": "application/json",
"x-authc-app-userid": opts.user.id,
},
}
},
);
const reply = await verificationResponse.json();
const appOrigin =
await verificationResponse.headers.get("x-authc-app-origin");

window.localStorage.setItem(
"ACCESS_TOKEN",
reply.data.attributes.access_token
reply.data.attributes.access_token,
);
showError.value = false;
showError.value = false;
Expand Down
2 changes: 1 addition & 1 deletion client/dist/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@tailwind utilities;
Loading

0 comments on commit 482ae8b

Please sign in to comment.