125 lines
4.6 KiB
Svelte
125 lines
4.6 KiB
Svelte
<script>
|
|
import ApiClient from "@/utils/ApiClient";
|
|
import CommonHelper from "@/utils/CommonHelper";
|
|
import CodeBlock from "@/components/base/CodeBlock.svelte";
|
|
import SdkTabs from "@/components/collections/docs/SdkTabs.svelte";
|
|
import FieldsQueryParam from "@/components/collections/docs/FieldsQueryParam.svelte";
|
|
|
|
export let collection;
|
|
|
|
let responseTab = 200;
|
|
let responses = [];
|
|
|
|
$: backendAbsUrl = CommonHelper.getApiExampleUrl(ApiClient.baseUrl);
|
|
|
|
$: responses = [
|
|
{
|
|
code: 200,
|
|
body: `
|
|
{
|
|
"usernamePassword": true,
|
|
"emailPassword": true,
|
|
"authProviders": [
|
|
{
|
|
"name": "github",
|
|
"state": "3Yd8jNkK_6PJG6hPWwBjLqKwse6Ejd",
|
|
"codeVerifier": "KxFDWz1B3fxscCDJ_9gHQhLuh__ie7",
|
|
"codeChallenge": "NM1oVexB6Q6QH8uPtOUfK7tq4pmu4Jz6lNDIwoxHZNE=",
|
|
"codeChallengeMethod": "S256",
|
|
"authUrl": "https://github.com/login/oauth/authorize?client_id=demo&code_challenge=NM1oVexB6Q6QH8uPtOUfK7tq4pmu4Jz6lNDIwoxHZNE%3D&code_challenge_method=S256&response_type=code&scope=user&state=3Yd8jNkK_6PJG6hPWwBjLqKwse6Ejd&redirect_uri="
|
|
},
|
|
{
|
|
"name": "gitlab",
|
|
"state": "NeQSbtO5cShr_mk5__3CUukiMnymeb",
|
|
"codeVerifier": "ahTFHOgua8mkvPAlIBGwCUJbWKR_xi",
|
|
"codeChallenge": "O-GATkTj4eXDCnfonsqGLCd6njvTixlpCMvy5kjgOOg=",
|
|
"codeChallengeMethod": "S256",
|
|
"authUrl": "https://gitlab.com/oauth/authorize?client_id=demo&code_challenge=O-GATkTj4eXDCnfonsqGLCd6njvTixlpCMvy5kjgOOg%3D&code_challenge_method=S256&response_type=code&scope=read_user&state=NeQSbtO5cShr_mk5__3CUukiMnymeb&redirect_uri="
|
|
},
|
|
{
|
|
"name": "google",
|
|
"state": "zB3ZPifV1TW2GMuvuFkamSXfSNkHPQ",
|
|
"codeVerifier": "t3CmO5VObGzdXqieakvR_fpjiW0zdO",
|
|
"codeChallenge": "KChwoQPKYlz2anAdqtgsSTdIo8hdwtc1fh2wHMwW2Yk=",
|
|
"codeChallengeMethod": "S256",
|
|
"authUrl": "https://accounts.google.com/o/oauth2/auth?client_id=demo&code_challenge=KChwoQPKYlz2anAdqtgsSTdIo8hdwtc1fh2wHMwW2Yk%3D&code_challenge_method=S256&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&state=zB3ZPifV1TW2GMuvuFkamSXfSNkHPQ&redirect_uri="
|
|
}
|
|
]
|
|
}
|
|
`,
|
|
},
|
|
];
|
|
</script>
|
|
|
|
<h3 class="m-b-sm">List auth methods ({collection.name})</h3>
|
|
<div class="content txt-lg m-b-sm">
|
|
<p>Returns a public list with all allowed <strong>{collection.name}</strong> authentication methods.</p>
|
|
</div>
|
|
|
|
<SdkTabs
|
|
js={`
|
|
import PocketBase from 'pocketbase';
|
|
|
|
const pb = new PocketBase('${backendAbsUrl}');
|
|
|
|
...
|
|
|
|
const result = await pb.collection('${collection?.name}').listAuthMethods();
|
|
`}
|
|
dart={`
|
|
import 'package:pocketbase/pocketbase.dart';
|
|
|
|
final pb = PocketBase('${backendAbsUrl}');
|
|
|
|
...
|
|
|
|
final result = await pb.collection('${collection?.name}').listAuthMethods();
|
|
`}
|
|
/>
|
|
|
|
<h6 class="m-b-xs">API details</h6>
|
|
<div class="alert alert-info">
|
|
<strong class="label label-primary">GET</strong>
|
|
<div class="content">
|
|
<p>
|
|
/api/collections/<strong>{collection.name}</strong>/auth-methods
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section-title">Query parameters</div>
|
|
<table class="table-compact table-border m-b-base">
|
|
<thead>
|
|
<tr>
|
|
<th>Param</th>
|
|
<th>Type</th>
|
|
<th width="50%">Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<FieldsQueryParam />
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="section-title">Responses</div>
|
|
<div class="tabs">
|
|
<div class="tabs-header compact combined left">
|
|
{#each responses as response (response.code)}
|
|
<button
|
|
class="tab-item"
|
|
class:active={responseTab === response.code}
|
|
on:click={() => (responseTab = response.code)}
|
|
>
|
|
{response.code}
|
|
</button>
|
|
{/each}
|
|
</div>
|
|
<div class="tabs-content">
|
|
{#each responses as response (response.code)}
|
|
<div class="tab-item" class:active={responseTab === response.code}>
|
|
<CodeBlock content={response.body} />
|
|
</div>
|
|
{/each}
|
|
</div>
|
|
</div>
|