PlusAuth Web API Reference
This API is intended to be used in PlusAuth views (Sign in, Register, etc.). Default views in PlusAuth uses PlusAuth Widget library. For your own custom views you need to make required requests to the corresponding endpoints.
const result = await fetch("/signin", { method: "POST", credentials: "include", headers: { "Content-Type": "application/json", "X-Requested-With": "XMLHttpRequest" }, body: JSON.stringify(data),})
if ( result.status === 400 && response.headers.get( 'content-type' ).includes('application/json') ){ const parsedResponse = await result.json() if ( parsedResponse.error === 'xhr_request' && parsedResponse.location ) { window.location.replace( parsedResponse.location ); return false; } else { // handle other errors }}
try{ axios.post("/signin", data, { headers: { "Content-Type": "application/json", "X-Requested-With": "XMLHttpRequest" }, withCredentials: true })}catch (error) { if (error.response && error.response.status === 400){ if ( error.response.data.error === 'xhr_request' && error.response.data.location ) { window.location.replace( error.response.data.location ); return false; } else { // handle other errors } }}