mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-09 06:09:20 +00:00
feat: device authorization endpoint (#270)
Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
AuthorizeResponse,
|
||||
OidcDeviceCodeInfo,
|
||||
OidcClient,
|
||||
OidcClientCreate,
|
||||
OidcClientMetaData,
|
||||
@@ -8,6 +9,7 @@ import type {
|
||||
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
|
||||
import APIService from './api-service';
|
||||
|
||||
|
||||
class OidcService extends APIService {
|
||||
async authorize(
|
||||
clientId: string,
|
||||
@@ -92,6 +94,15 @@ class OidcService extends APIService {
|
||||
const res = await this.api.put(`/oidc/clients/${id}/allowed-user-groups`, { userGroupIds });
|
||||
return res.data as OidcClientWithAllowedUserGroups;
|
||||
}
|
||||
|
||||
async verifyDeviceCode(userCode: string) {
|
||||
return await this.api.post(`/oidc/device/verify?code=${userCode}`);
|
||||
}
|
||||
|
||||
async getDeviceCodeInfo(userCode: string): Promise<OidcDeviceCodeInfo> {
|
||||
const response = await this.api.get(`/oidc/device/info?code=${userCode}`);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export default OidcService;
|
||||
|
||||
Reference in New Issue
Block a user