Skip to content

Customer Logout ​

Logout a customer and invalidate their authentication tokens.

The deviceToken field applies only when the Bagisto Push Notification package is installed. If the customer logged in with a deviceToken, the same token must be passed here on logout to properly deregister the device and stop push notifications for that session. If the package is not installed, this field can be omitted.

Authentication ​

This query requires a valid customer authentication token in the Authorization header. Use the Customer Login API to retrieve the token.

Authorization: Bearer <accessToken>

Arguments ​

ArgumentTypeRequiredDescription
deviceTokenString❌ NoFCM device token. Required only if the customer logged in with a deviceToken and the Push Notification package is installed.

Response ​

FieldTypeDescription
messageStringSuccess or error message
successBooleanLogout success status

Behavior ​

  • Invalidates the current access token
  • Invalidates the refresh token
  • Clears any session-related data
  • Customer will need to login again for future requests
  • If logged in with a deviceToken, passing the same token on logout deregisters the device from push notifications

Error Responses ​

json
{
  "errors": {
    "authentication": ["Unauthorized: Invalid or expired token"]
  }
}

Released under the MIT License.