Agent from connect() gives the same handle with agent.for_end_user(…)
(forEndUser(…)), without another round trip: the tool set an admin bound is the
application’s, identical for everyone it acts for. What changes is one header,
X-NeuralTrust-End-User.
No startup check, a link instead
connect() refuses to start when a server has no account, because a batch has
nobody to send a link to. A person does, so for_end_user() does not check at
startup. When a call needs an account the user has not connected, the gateway
refuses it with ConsentRequiredError, and the link to connect arrives inside
the error, because that is where the gateway mints it.
When you would rather ask than fail, check ahead of time:
Whose name it is
The name is yours to choose, and the gateway does not verify it: it trusts the application that holds the key. Whoever holds the key can name anyone, and a call that names a person reaches the accounts that person connected through this application. So the key is the identity check: run the SDK where only your backend holds it, and take the name from the session your backend already authenticated, never from what the client sends.user_123
never reach the same account, and the accounts a person connected in the
Employee portal are never reachable by name. For the same
reason only an application’s own credential may assert one: a request carrying a
person’s own token is already that person.
This is the code side of acting for end users on the
gateway.