Tickets POST requiring Auth Token

Forum dedicated to Mods for HESK created by Mike Koch

Moderator: mkoch227

Post Reply
prostar190fan
Posts: 17
Joined: Mon Oct 30, 2017 8:35 pm

Tickets POST requiring Auth Token

Post by prostar190fan »

Script URL: localhost
Mods for HESK version: 3.2.1
HESK version: 2.7.3
Hosting company: Self Hosted/IIS 10
URL of phpinfo.php: n/a
URL of session_test.php: n/a
What terms did you try when SEARCHING for a solution: auth

Write your message below:

To completely eliminate the possibility of someone using the API to generate a ticket that is not supposed to, is there a way to restrict the ticket POST to only those with an auth token?

I saw in the latest notes (3.2.0) that the functionality was taken away?

Thanks,

Tom
mkoch227
Posts: 666
Joined: Wed Jul 04, 2012 3:37 pm

Re: Tickets POST requiring Auth Token

Post by mkoch227 »

In /api/index.php, find:

Code: Select all

'/v1/tickets' => action(\Controllers\Tickets\CustomerTicketController::clazz(), RequestMethod::all(), SecurityHandler::OPEN),
Change "SecurityHandler::OPEN" to "SecurityHandler::AUTH_TOKEN"

Regarding whether that endpoint should be open or require a token in the future, I'm still debating that personally (hence why the API is still considered to be in beta ;) ). Once I get around to adding "generic" auth tokens (that are not tied to a specific user), I may end up requiring an auth token for all requests again.
Mike, Lead Developer of Image HESK: A surprisingly simple, user-friendly and FREE help desk software with integrated knowledgebase.
prostar190fan
Posts: 17
Joined: Mon Oct 30, 2017 8:35 pm

Re: Tickets POST requiring Auth Token

Post by prostar190fan »

mkoch227 wrote: Tue Nov 07, 2017 6:45 pm In /api/index.php, find:

Code: Select all

'/v1/tickets' => action(\Controllers\Tickets\CustomerTicketController::clazz(), RequestMethod::all(), SecurityHandler::OPEN),
Change "SecurityHandler::OPEN" to "SecurityHandler::AUTH_TOKEN"

Regarding whether that endpoint should be open or require a token in the future, I'm still debating that personally (hence why the API is still considered to be in beta ;) ). Once I get around to adding "generic" auth tokens (that are not tied to a specific user), I may end up requiring an auth token for all requests again.

Thank you very much Mike,

I'm guessing I can send the token with "auth_token" => "tokenID", from within the JSON Array?

Thanks,

Tom
mkoch227
Posts: 666
Joined: Wed Jul 04, 2012 3:37 pm

Re: Tickets POST requiring Auth Token

Post by mkoch227 »

The token should be passed in as a request header (X-Auth-Token: <token here>).
Mike, Lead Developer of Image HESK: A surprisingly simple, user-friendly and FREE help desk software with integrated knowledgebase.
Post Reply