mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 17:24:26 +08:00
support Nextcloud OAuth 2.0 authentication
This commit is contained in:
@@ -135,6 +135,9 @@ import type {
|
||||
UserProfileUpdateRequest,
|
||||
UserProfileUpdateResponse
|
||||
} from '@/models/user.ts';
|
||||
import type {
|
||||
OAuth2CallbackLoginRequest
|
||||
} from '@/models/oauth2.ts';
|
||||
import type {
|
||||
UserApplicationCloudSettingsUpdateRequest
|
||||
} from '@/models/user_app_cloud_setting.ts';
|
||||
@@ -265,6 +268,13 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
authorizeOAuth2: ({ req, token }: { req: OAuth2CallbackLoginRequest, token: string }): ApiResponsePromise<AuthResponse> => {
|
||||
return axios.post<ApiResponse<AuthResponse>>('oauth2/authorize.json', req, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`
|
||||
}
|
||||
});
|
||||
},
|
||||
register: (req: UserRegisterRequest): ApiResponsePromise<RegisterResponse> => {
|
||||
return axios.post<ApiResponse<RegisterResponse>>('register.json', req);
|
||||
},
|
||||
@@ -695,6 +705,9 @@ export default {
|
||||
cancelRequest: (cancelableUuid: string) => {
|
||||
cancelableRequests[cancelableUuid] = true;
|
||||
},
|
||||
generateOAuth2LoginUrl: (platform: 'mobile' | 'desktop', clientSessionId: string): string => {
|
||||
return `${getBasePath()}/oauth2/login?platform=${platform}&client_session_id=${clientSessionId}`;
|
||||
},
|
||||
generateQrCodeUrl: (qrCodeName: string): string => {
|
||||
return `${getBasePath()}${BASE_QRCODE_PATH}/${qrCodeName}.png`;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user