Apple Authentication

Authenticate (Apple)

Authenticate a User using Apple idToken. This endpoint is used to authenticate users who have logged in using Apple OAuth. For more details, see our Authentication Methods guide. Refer to the Apple Auth API template script for implementation guidance.

POST
/api/oc/v1/authenticate

Request Body

application/jsonRequired
authDataRequiredobject
sessionDataRequiredobject
sessionPkClientSignatureRequiredstring

Client signature of the session public key

sessionDataUserSignatureRequiredstring

User signature of the session data

curl -X POST "https://sandbox-api.okto.tech/api/oc/v1/authenticate" \
  -H "Content-Type: application/json" \
  -d '{
    "authData": {
      "idToken": "eyJraWQiOiJyczBNM2tPVjlwIiwiYWxnIjoiUlMyNTYifQ..",
      "provider": "apple"
    },
    "sessionData": {
      "nonce": "f9e806da-2474-474b-8807-7e023741f4b7",
      "clientSWA": "0xdb70Faf78B19576d3C969487cb75f5152cee2E8F",
      "sessionPk": "0x0479ac376b8ed6344a9b639a2d926187e0dc1be703bb39cc37e33364fc825179ea25849d51cbfca3c0c515d6c09314028d904b2faf402ddf7ed6ebf9ada5a47c43",
      "maxPriorityFeePerGas": "0xBA43B7400",
      "maxFeePerGas": "0xBA43B7400",
      "paymaster": "0x74324fA6Fa67b833dfdea4C1b3A9898574d076e3",
      "paymasterData": "0x000000000000000000000000db70faf78b19576d3c969487cb75f5152cee2e8f00000000000000000000000000000000000000000000000000000000684dc459000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000041433487e01b4721100acacf9974353e27234d4677e24179487010581e1706111438a01687677119367b055855e772d8abaac091964cec1fac252f7f13436b584f1c00000000000000000000000000000000000000000000000000000000000000"
    },
    "sessionPkClientSignature": "0xd8f40c1c4bd5feda66b61473fa3390ad6095d6e2c3b2631eb2bee0177b4abc1819df60079c5cae2d0bf7d4dae693dee5ee75c6be9c40cf4801aad51dfb19fe811b",
    "sessionDataUserSignature": "0x3d995180af0e04105e41995e0392ed250479265835115e177bc1314842cef059503e897dd39444ac4658b0d35fdba728936abf5d1d524ba381d1ce0f91437bac1c"
  }'

User Authenticated Successfully

{
  "status": "success",
  "data": {
    "userSWA": "0xb7ab3D9004286d1eDeFFA0E7Ec6cc6cDf0F38abF",
    "clientSWA": "0xdb70Faf78B19576d3C969487cb75f5152cee2E8F",
    "nonce": "0x00000000000000000000000000000000f9e806da2474474b88077e023741f4b7",
    "sessionExpiry": 1750769404
  }
}