mirror of
https://github.com/standardnotes/server
synced 2026-07-14 00:01:54 -04:00
fix(syncing-server): calling auth server for user key params
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { KeyParamsData } from '@standardnotes/responses'
|
||||
|
||||
export interface AuthHttpServiceInterface {
|
||||
getUserKeyParams(dto: { email?: string; uuid?: string; authenticated: boolean }): Promise<KeyParamsData>
|
||||
getUserKeyParams(userUuid: string): Promise<KeyParamsData>
|
||||
}
|
||||
|
||||
@@ -42,10 +42,7 @@ export class EmailBackupRequestedEventHandler implements DomainEventHandlerInter
|
||||
): Promise<void> {
|
||||
let authParams: KeyParamsData
|
||||
try {
|
||||
authParams = await this.authHttpService.getUserKeyParams({
|
||||
uuid: event.payload.userUuid,
|
||||
authenticated: false,
|
||||
})
|
||||
authParams = await this.authHttpService.getUserKeyParams(event.payload.userUuid)
|
||||
} catch (error) {
|
||||
this.logger.error(
|
||||
`Could not get user key params from auth service for user ${event.payload.userUuid}: ${
|
||||
|
||||
@@ -9,15 +9,14 @@ export class AuthHttpService implements AuthHttpServiceInterface {
|
||||
private authServerUrl: string,
|
||||
) {}
|
||||
|
||||
async getUserKeyParams(dto: { email?: string; uuid?: string; authenticated: boolean }): Promise<KeyParamsData> {
|
||||
async getUserKeyParams(userUuid: string): Promise<KeyParamsData> {
|
||||
const keyParamsResponse = await this.httpClient.request({
|
||||
method: 'GET',
|
||||
timeout: 10000,
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
},
|
||||
url: `${this.authServerUrl}/users/params`,
|
||||
params: dto,
|
||||
url: `${this.authServerUrl}/users/params?uuid=${userUuid}`,
|
||||
validateStatus:
|
||||
/* istanbul ignore next */
|
||||
(status: number) => status >= 200 && status < 500,
|
||||
|
||||
Reference in New Issue
Block a user