---
updatedAt: 2025-06-04T20:09:51.000Z
agentTools:
  projectIndex: https://vrpay.readme.io/llms.txt
---

# Login a subscription customer

If you configured recurring payments (subscriptions), VR pay secure will automatically create user accounts for your customers. So your users can administrate the subscriptions and cancel them on VR pay secure site.

Often they don't know where to cancel the subscription. You can provide a link which will directly log them in to your VR pay secure page where they can cancel subscriptions, change payment information and more.

![622](https://files.readme.io/87724c6-YE9FFEmpSlWOQzt71KgV_AuthToken.png "YE9FFEmpSlWOQzt71KgV_AuthToken.png")

The userId for this endpoint will be included in the subscription's webhook.

First your application requests a new authentication link. This means you get a link based on a contact id (param: userId) which you received through a VR pay secure Webhook.

You can display the link to your user, or automatically redirect your user. After a click on the link the user will be automatically logged in. This means the customer can then see all fired payments and all subscriptions.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "api-settings",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "http://api.vr-pay-secure.de/v1.0"
    }
  ],
  "security": [
    {}
  ],
  "paths": {
    "/AuthToken/": {
      "post": {
        "summary": "Login a subscription customer",
        "description": "",
        "operationId": "autologin",
        "parameters": [
          {
            "name": "instance",
            "in": "query",
            "description": "Your VR pay secure instance name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "userId"
                ],
                "properties": {
                  "userId": {
                    "type": "integer",
                    "description": "The contact id you received through webhook data.",
                    "default": 0,
                    "format": "int32"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Raw": {
                    "value": "{\n\tstatus: \"success\",\n  data: [\n  \t{\n    \tuserId: 1,\n      authToken: \"b0b0d62f4872ce5c45377b3bedd8185f\",\n      authTokenExpirationDate: \"2015-07-14 14:00:00\",\n      link: \"https://demo.vr-pay-secure.de/?auth_token=b0b0d62f4872ce5c45377b3bedd8185f\"\n    }\n  ]\n}"
                  }
                }
              },
              "text/plain": {
                "examples": {
                  "PHP Object": {
                    "value": "VRpay\\Models\\Response\\AuthToken::__set_state(array(\n   'authToken' => 'b0b0d62f4872ce5c45377b3bedd8185f',\n   'authTokenExpirationDate' => '2015-07-14 14:00:00',\n   'link' => 'https://demo.vr-pay-secure.de/?auth_token=b0b0d62f4872ce5c45377b3bedd8185f',\n))"
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "apiSignature=`echo -n \"userId=1\" | openssl dgst -sha256 -hmac \"INSTANCE_API_SECRET\" -binary | openssl enc -base64`\ncurl --request POST \"https://api.vr-pay-secure.de/v1.0/AuthToken/?instance=INSTANCE_NAME\" --data-urlencode \"ApiSignature=$apiSignature\" --data-urlencode \"userId=1\""
            },
            {
              "language": "php",
              "code": "<?php\n// $instanceName is a part of the url where you access your VR pay secure installation.\n// https://{$instanceName}.vr-pay-secure.de\n$instanceName = 'INSTANCE_NAME';\n\n// $secret is the VR pay secure secret for the communication between the applications\n// if you think someone got your secret, just regenerate it in the VR pay secure administration\n$secret = 'INSTANCE_API_SECRET';\n$vrpay = new \\VRpay\\VRpay($instanceName, $secret);\n\n// init empty request object\n$authToken = new \\VRpay\\Models\\Request\\AuthToken();\n\n// info for auth token (user id)\n$authToken->setUserId(1);\n\n// fire request with created and filled authToken request-object.\ntry {\n    $response = $vrpay->create($authToken);\n    \n    // response data can get accessed like this\n    $authToken = $response->getAuthToken();\n    $authTokenExpirationDate = $response->getAuthTokenExpirationDate();\n    $link = $response->getLink();\n} catch (\\VRpay\\VRpayException $e) {\n    print $e->getMessage();\n}"
            }
          ],
          "samples-languages": [
            "curl",
            "php"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```