Login Device API

Register a device login session and authenticate the device for VPN access

Device Authentication

Login Device API

Authenticate and register device login sessions. Creates a new active session for an already-activated device, enabling VPN connectivity.

Session Creation

Create authenticated sessions for device connections.

Secure Login

Validate device credentials before granting access.

Session Tracking

Track device sessions for monitoring and management.


Endpoint Overview

MUTATION/graphql

Register a login session for a device, authenticating it for VPN access. The device must be previously activated for the user's account.

Authentication:Bearer Token

Request Parameters

userIdInt!Required

The unique identifier of the user logging in the device.

deviceIdInputDeviceIdInput!Required

Object containing device identification details.

uuidString!Required

The device's universally unique identifier.

serialString!Required

The device's serial number.

nameString!Required

The device's friendly name.


GraphQL Mutation

mutation loginDevice($userId: Int!, $deviceIdInput: DeviceIdInput!) {
  loginDevice(userId: $userId, deviceIdInput: $deviceIdInput) {
    sessionId
    deviceId
    loginTime
    expiresAt
  }
}

Variables:

{
  "userId": 12345,
  "deviceIdInput": {
    "uuid": "550e8400-e29b-41d4-a716-446655440000",
    "serial": "ABC123XYZ789",
    "name": "John's iPhone 15"
  }
}

HTTP Request:

curl -X POST https://api.orbnet.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "query": "mutation loginDevice($userId: Int!, $deviceIdInput: DeviceIdInput!) { loginDevice(userId: $userId, deviceIdInput: $deviceIdInput) { sessionId deviceId loginTime expiresAt } }",
    "variables": {
      "userId": 12345,
      "deviceIdInput": {
        "uuid": "550e8400-e29b-41d4-a716-446655440000",
        "serial": "ABC123XYZ789",
        "name": "Johns iPhone 15"
      }
    }
  }'

Response

200Device Logged In Successfully
{
  "data": {
    "loginDevice": {
      "sessionId": "sess_abc123xyz789",
      "deviceId": "67890",
      "loginTime": "2024-01-15T10:30:00Z",
      "expiresAt": "2024-01-16T10:30:00Z"
    }
  }
}
400Device Not Activated
{
  "errors": [
    {
      "message": "Device not activated for this user",
      "path": ["loginDevice"],
      "extensions": {
        "code": "DEVICE_NOT_ACTIVATED"
      }
    }
  ],
  "data": null
}
400Subscription Expired
{
  "errors": [
    {
      "message": "User subscription has expired",
      "path": ["loginDevice"],
      "extensions": {
        "code": "SUBSCRIPTION_EXPIRED"
      }
    }
  ],
  "data": null
}

Login Flow

Device Activation Check

Subscription Validation

Session Creation

Connection Ready


Best Practices

Activate First

Ensure devices are activated before attempting login.

Handle Expiry

Implement auto-refresh for sessions approaching expiration.

Store Session ID

Save the session ID for logout and monitoring operations.

Error Handling

Handle expired subscriptions and inactive devices gracefully.



Session Expiration

Device sessions have an expiration time. The client application should handle session refresh or re-login when sessions expire to maintain uninterrupted VPN access.

Need to Register a New Device?

Before logging in a device, it must be activated. Use the Activate Device API to register new devices.

Activate Device API