Türkçe dil desteğimiz henüz tamamlandı. Eksik sayfalar veya bölümlerle karşılaşmanız durumunda İngilizce dilini seçerek sayfanın orjinalini görebilirsiniz.

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.

If you are going to make requests with XHR/Fetch make sure to include credentials as endpoints in this API mostly depend on user session.
Some requests may respond with a redirection. If you are dispatching requests with XHR/Fetch like clients make sure you redirect to given location. In such situations if your request contains X-Requested-With header with the value XMLHttpRequest, PlusAuth will return a JSON response instead of redirect.

Here is an example response:
{
  "error": "xhr_request",
  "error_description": "You need to redirect to the given location.",
  "location": "https://somelocation"
}
Fetch
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' ).indexOf('application/json') > 0 ){
  const parsedResponse = await result.json()
  if ( parsedResponse.error === 'xhr_request' && parsedResponse.location ) {
    window.location.replace( parsedResponse.location );
    return false;
  } else {
    // handle other errors
  }
}