import{S as je,i as ze,s as Fe,M as We,e as s,w,b as h,c as re,f as p,g as i,h as a,m as ce,x as de,N as De,O as Ve,k as Le,P as Ee,n as Je,t as L,a as E,o as r,d as ue,R as Ne,C as Ue,p as Ie,r as J,u as Ke}from"./index-41f683eb.js";import{S as Qe}from"./SdkTabs-b5ab576b.js";function Be(c,l,o){const n=c.slice();return n[5]=l[o],n}function Me(c,l,o){const n=c.slice();return n[5]=l[o],n}function Re(c,l){let o,n=l[5].code+"",m,v,d,b;function k(){return l[4](l[5])}return{key:c,first:null,c(){o=s("button"),m=w(n),v=h(),p(o,"class","tab-item"),J(o,"active",l[1]===l[5].code),this.first=o},m(g,O){i(g,o,O),a(o,m),a(o,v),d||(b=Ke(o,"click",k),d=!0)},p(g,O){l=g,O&4&&n!==(n=l[5].code+"")&&de(m,n),O&6&&J(o,"active",l[1]===l[5].code)},d(g){g&&r(o),d=!1,b()}}}function He(c,l){let o,n,m,v;return n=new We({props:{content:l[5].body}}),{key:c,first:null,c(){o=s("div"),re(n.$$.fragment),m=h(),p(o,"class","tab-item"),J(o,"active",l[1]===l[5].code),this.first=o},m(d,b){i(d,o,b),ce(n,o,null),a(o,m),v=!0},p(d,b){l=d;const k={};b&4&&(k.content=l[5].body),n.$set(k),(!v||b&6)&&J(o,"active",l[1]===l[5].code)},i(d){v||(L(n.$$.fragment,d),v=!0)},o(d){E(n.$$.fragment,d),v=!1},d(d){d&&r(o),ue(n)}}}function Ge(c){let l,o,n=c[0].name+"",m,v,d,b,k,g,O,x,N,A,j,he,z,P,pe,I,F=c[0].name+"",K,be,Q,D,G,U,X,B,Y,S,Z,fe,ee,T,te,me,ae,ve,f,we,C,ke,ge,_e,le,ye,oe,Oe,Ae,Se,se,Te,ne,M,ie,$,R,y=[],$e=new Map,Ce,H,_=[],qe=new Map,q;g=new Qe({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${c[3]}'); ... // This method initializes a one-off realtime subscription and will // open a popup window with the OAuth2 vendor page to authenticate. // // Once the external OAuth2 sign-in/sign-up flow is completed, the popup // window will be automatically closed and the OAuth2 data sent back // to the user through the previously established realtime connection. const authData = await pb.collection('users').authWithOAuth2({ provider: 'google' }); // after the above you can also access the auth data from the authStore console.log(pb.authStore.isValid); console.log(pb.authStore.token); console.log(pb.authStore.model.id); // "logout" the last authenticated model pb.authStore.clear(); `,dart:` import 'package:pocketbase/pocketbase.dart'; import 'package:url_launcher/url_launcher.dart'; final pb = PocketBase('${c[3]}'); ... // This method initializes a one-off realtime subscription and will // call the provided urlCallback with the OAuth2 vendor url to authenticate. // // Once the external OAuth2 sign-in/sign-up flow is completed, the browser // window will be automatically closed and the OAuth2 data sent back // to the user through the previously established realtime connection. final authData = await pb.collection('users').authWithOAuth2('google', (url) async { await launchUrl(url); }); // after the above you can also access the auth data from the authStore print(pb.authStore.isValid); print(pb.authStore.token); print(pb.authStore.model.id); // "logout" the last authenticated model pb.authStore.clear(); `}}),C=new We({props:{content:"?expand=relField1,relField2.subRelField"}});let V=c[2];const xe=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eAuthenticate with an OAuth2 provider and returns a new auth token and record data.

For more details please check the OAuth2 integration documentation .

`,k=h(),re(g.$$.fragment),O=h(),x=s("h6"),x.textContent="API details",N=h(),A=s("div"),j=s("strong"),j.textContent="POST",he=h(),z=s("div"),P=s("p"),pe=w("/api/collections/"),I=s("strong"),K=w(F),be=w("/auth-with-oauth2"),Q=h(),D=s("div"),D.textContent="Body Parameters",G=h(),U=s("table"),U.innerHTML=`Param Type Description
Required provider
String The name of the OAuth2 client provider (eg. "google").
Required code
String The authorization code returned from the initial request.
Required codeVerifier
String The code verifier sent with the initial request as part of the code_challenge.
Required redirectUrl
String The redirect url sent with the initial request.
Optional createData
Object

Optional data that will be used when creating the auth record on OAuth2 sign-up.

The created auth record must comply with the same requirements and validations in the regular create action.
The data can only be in json, aka. multipart/form-data and files upload currently are not supported during OAuth2 sign-ups.

`,X=h(),B=s("div"),B.textContent="Query parameters",Y=h(),S=s("table"),Z=s("thead"),Z.innerHTML=`Param Type Description`,fe=h(),ee=s("tbody"),T=s("tr"),te=s("td"),te.textContent="expand",me=h(),ae=s("td"),ae.innerHTML='String',ve=h(),f=s("td"),we=w(`Auto expand record relations. Ex.: `),re(C.$$.fragment),ke=w(` Supports up to 6-levels depth nested relations expansion. `),ge=s("br"),_e=w(` The expanded relations will be appended to the record under the `),le=s("code"),le.textContent="expand",ye=w(" property (eg. "),oe=s("code"),oe.textContent='"expand": {"relField1": {...}, ...}',Oe=w(`). `),Ae=s("br"),Se=w(` Only the relations to which the request user has permissions to `),se=s("strong"),se.textContent="view",Te=w(" will be expanded."),ne=h(),M=s("div"),M.textContent="Responses",ie=h(),$=s("div"),R=s("div");for(let e=0;eo(1,v=k.code);return c.$$set=k=>{"collection"in k&&o(0,m=k.collection)},c.$$.update=()=>{c.$$.dirty&1&&o(2,d=[{code:200,body:JSON.stringify({token:"JWT_AUTH_TOKEN",record:Ue.dummyCollectionRecord(m),meta:{id:"abc123",name:"John Doe",username:"john.doe",email:"test@example.com",avatarUrl:"https://example.com/avatar.png",accessToken:"...",refreshToken:"...",rawUser:{}}},null,2)},{code:400,body:` { "code": 400, "message": "An error occurred while submitting the form.", "data": { "provider": { "code": "validation_required", "message": "Missing required value." } } } `}])},o(3,n=Ue.getApiExampleUrl(Ie.baseUrl)),[m,v,d,n,b]}class et extends je{constructor(l){super(),ze(this,l,Xe,Ge,Fe,{collection:0})}}export{et as default};