Authentication
Complete guide to login, JWT tokens, and delegation for group operations
01
Login with Services
Authenticate with YieldFabric and request access to specific services:
curl -X POST https://auth.yieldfabric.com/auth/login/with-services \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "your-password",
"services": ["vault", "payments"]
}'Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "refresh_token_here",
"user": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"email": "user@example.com",
"role": "User",
"account_address": "0x1234..."
}
}Save your token:
export TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."02
Delegate Authentication
Create a delegation JWT to perform operations on behalf of a group account:
curl -X POST https://auth.yieldfabric.com/auth/delegation/jwt \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"group_id": "550e8400-e29b-41d4-a716-446655440000",
"delegation_scope": ["read", "write", "manage"],
"expiry_seconds": 3600
}'Response includes:
delegation_jwt- Token for group operationsdelegation_scope- Permitted operationsexpiry_seconds- Token lifetimegroup_id- Group identifier
03
Manage Delegation Tokens
List Active Tokens
curl -X GET https://auth.yieldfabric.com/auth/delegation-tokens \
-H "Authorization: Bearer $TOKEN"Revoke a Token
curl -X DELETE https://auth.yieldfabric.com/auth/delegation-tokens/{token_id} \
-H "Authorization: Bearer $TOKEN"04
Using Delegation Tokens
For Group Operations
Use delegation token to perform crypto operations on behalf of the group
For Balance Queries
Query group balances using the delegation token
Example: Group Payment
curl -X POST https://pay.yieldfabric.com/graphql \
-H "Authorization: Bearer $DELEGATION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "mutation { instant(input: { assetId: \"aud-token-asset\", amount: \"100\", destinationId: \"recipient@yieldfabric.com\" }) { success paymentId } }"
}'05
JWT Token Structure
Standard User JWT
{
"sub": "550e8400-e29b-41d4-a716-446655440000",
"aud": ["vault", "payments"],
"exp": 1697712000,
"iat": 1697625600,
"role": "Operator",
"permissions": ["CryptoOperations", "ViewSignatureKeys"],
"entity_scope": [],
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"auth_method": "jwt",
"entity_type": "user",
"email": "user@example.com",
"account_address": "0x1234567890abcdef...",
"group_account_address": null,
"acting_as": null,
"delegation_scope": null,
"delegation_token_id": null
}Key Fields:
sub- User ID (UUID)aud- Allowed servicesrole- User role (SuperAdmin, Admin, Manager, Operator, Viewer, ApiClient)permissions- Specific permission stringsaccount_address- User's intelligent account address
Delegation JWT
{
"sub": "550e8400-e29b-41d4-a716-446655440000",
"aud": ["yieldfabric"],
"auth_method": "delegation",
"group_account_address": "0xabcdef1234567890...",
"acting_as": "group-id-550e8400-...",
"delegation_scope": ["CryptoOperations", "ReadGroup"],
"delegation_token_id": "c3d4e5f6-a7b8-9012-cdef-...",
...
}Delegation-Specific Fields:
auth_method- Set to "delegation"group_account_address- Group's account addressacting_as- Group ID user is acting on behalf ofdelegation_scope- Allowed operationsdelegation_token_id- For tracking and revocation
06
User Roles
SuperAdmin
Full system access
All permissions automatically granted
Admin
Administrative operations
User & group management
Manager
Manage entities and groups
Group operations & delegation
Operator
Service access + admin
Use services & manage groups
Viewer
Read-only access
View information only
ApiClient
API integration access
Service-specific operations
07
Common Permissions
| Permission | Description |
|---|---|
| CryptoOperations | Perform cryptographic operations |
| ViewSignatureKeys | View signing keys |
| ManageSignatureKeys | Manage signing keys |
| CreateGroup | Create new groups |
| CreateDelegationToken | Create delegation tokens |
08
Auth Service Endpoints
POST
/auth/login/with-servicesLogin with service selectionPOST
/auth/refreshRefresh access tokenGET
/auth/users/meGet user profilePOST
/auth/delegation/jwtCreate delegation token