Skip to main content
POST
/
v2
/
auth
/
google
/
login
Google login
curl --request POST \
  --url https://staging.api.prexsell.com/v2/auth/google/login \
  --header 'Content-Type: application/json' \
  --data '
{
  "idToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "companyId": "cmp_xyz789"
}
'
import requests

url = "https://staging.api.prexsell.com/v2/auth/google/login"

payload = {
"idToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"companyId": "cmp_xyz789"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({idToken: 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...', companyId: 'cmp_xyz789'})
};

fetch('https://staging.api.prexsell.com/v2/auth/google/login', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.prexsell.com/v2/auth/google/login",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idToken' => 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...',
'companyId' => 'cmp_xyz789'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://staging.api.prexsell.com/v2/auth/google/login"

payload := strings.NewReader("{\n \"idToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\n \"companyId\": \"cmp_xyz789\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://staging.api.prexsell.com/v2/auth/google/login")
.header("Content-Type", "application/json")
.body("{\n \"idToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\n \"companyId\": \"cmp_xyz789\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://staging.api.prexsell.com/v2/auth/google/login")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"idToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\n \"companyId\": \"cmp_xyz789\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "user": {
      "id": "usr_abc123def456",
      "email": "user@example.com",
      "firstName": "ะ†ะฒะฐะฝ",
      "lastName": "ะŸะตั‚ั€ะตะฝะบะพ"
    },
    "access": {
      "contextType": "COMPANY",
      "companyId": "cmp_xyz789",
      "partnerId": null,
      "role": "ADMIN",
      "company": {
        "id": "cmp_xyz789",
        "name": "Prexsell Bus Lines",
        "slug": "prexsell-bus-lines",
        "tier": "PRO"
      }
    },
    "session": {
      "id": "ses_q1w2e3r4t5",
      "contextType": "COMPANY",
      "companyId": "cmp_xyz789",
      "userId": "usr_abc123def456",
      "expiresAt": "2026-06-28T00:00:00.000Z",
      "lastUsedAt": "2026-05-28T12:00:00.000Z",
      "revokedAt": null
    },
    "availableAccesses": []
  }
}
{
"errors": [
{
"message": "AUTH_INVALID_CREDENTIALS",
"errorCode": "UNAUTHORIZED"
}
]
}

Body

application/json

Google ID token and optional company context for Google-based login.

idToken
string
required

A Google ID token obtained from the Google Sign-In flow.

Example:

"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."

companyId
string

Optional company to log into directly, bypassing the pre-login company-selection step.

Example:

"cmp_xyz789"

Response

Successful Google login. Access and refresh tokens are set as HTTP-only cookies.

data
object
required

Full authentication payload returned after a successful login, token refresh, or session fetch.