mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-15 17:23:23 +03:00
23 lines
485 B
TypeScript
23 lines
485 B
TypeScript
import type { Page } from '@playwright/test';
|
|
|
|
async function getUserCode(page: Page, clientId: string, clientSecret: string) {
|
|
const response = await page.request
|
|
.post('/api/oidc/device/authorize', {
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
form: {
|
|
client_id: clientId,
|
|
client_secret: clientSecret,
|
|
scope: 'openid profile email'
|
|
}
|
|
})
|
|
.then((r) => r.json());
|
|
|
|
return response.user_code;
|
|
}
|
|
|
|
export default {
|
|
getUserCode
|
|
};
|