alexAlToader
New member
Hi,
We are trying to build an API on xenforo.
We need a token for each user - which respects the users permissions.
I understand that this token is the one created in admin->Setup->ApiKeys->user->[userName]
I suspect that if we use this token in XF-Api-Key - we can make API calls with user permissions?
If so, on /api/auth, we need to return this token if login is successful.
I cant find this functionality in the docs. The existing /auth/login-token seems to be for frontend not API. (am i right?)
So what I am trying to do is to create the token in login.
The token I think is created in ApiKey->actionSave
The current problem is that when I call
I dont know how to get the key.
When I try to get the key - is null.
So, if what I am dong is right, then how do I get the key pls?
And which one is t? The apiKey or apiKeyHash?
Best regards,
AlexT
We are trying to build an API on xenforo.
We need a token for each user - which respects the users permissions.
I understand that this token is the one created in admin->Setup->ApiKeys->user->[userName]
I suspect that if we use this token in XF-Api-Key - we can make API calls with user permissions?
If so, on /api/auth, we need to return this token if login is successful.
I cant find this functionality in the docs. The existing /auth/login-token seems to be for frontend not API. (am i right?)
So what I am trying to do is to create the token in login.
The token I think is created in ApiKey->actionSave
The current problem is that when I call
/** @var \XF\Service\ApiKey\Manager $keyManager */
$keyManager = $this->service('XF:ApiKey\Manager', $apiKey);
$this->apiKeySaveProcess($keyManager)->run();
I dont know how to get the key.
When I try to get the key - is null.
$key = $keyManager->getKey();
$key->save();
var_dump( $key->apiKey );
So, if what I am dong is right, then how do I get the key pls?
And which one is t? The apiKey or apiKeyHash?
Best regards,
AlexT