Skip to content

Commit 194bf44

Browse files
committed
Change /access-token deviceId header name to Hub-Device-ID
1 parent 69c1390 commit 194bf44

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

backend/src/main/java/org/cryptomator/hub/api/VaultResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ public Response unlock(@PathParam("vaultId") UUID vaultId, @QueryParam("evenIfAr
323323
throw new ActionRequiredException("User account not initialized.");
324324
}
325325
var ipAddress = request.remoteAddress().host();
326-
var deviceId = request.getHeader("deviceId");
326+
var deviceId = request.getHeader("Hub-Device-ID");
327327
var access = accessTokenRepo.unlock(vaultId, jwt.getSubject());
328328
if (access != null) {
329329
eventLogger.logVaultKeyRetrieved(jwt.getSubject(), vaultId, VaultKeyRetrievedEvent.Result.SUCCESS, ipAddress, deviceId);

frontend/src/common/backend.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,11 @@ class VaultService {
203203
}
204204

205205
public async accessToken(vaultId: string, deviceId?: string, evenIfArchived = false): Promise<string> {
206-
const deviceIdQueryParam = deviceId !== undefined ? `&deviceId=${deviceId}` : '';
207-
return axiosAuth.get(`/vaults/${vaultId}/access-token?evenIfArchived=${evenIfArchived}${deviceIdQueryParam}`, { headers: { 'Content-Type': 'text/plain', 'deviceId': deviceId } })
206+
const headers: Record<string, string> = { 'Content-Type': 'text/plain' };
207+
if (deviceId) {
208+
headers['Hub-Device-ID'] = deviceId;
209+
}
210+
return axiosAuth.get(`/vaults/${vaultId}/access-token?evenIfArchived=${evenIfArchived}`, { headers })
208211
.then(response => response.data)
209212
.catch((error) => rethrowAndConvertIfExpected(error, 402, 403));
210213
}

0 commit comments

Comments
 (0)