From 601dc85042ab063411c0a2cdc15dda34f26d7148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thor=20K=2E=20H=C3=B8g=C3=A5s?= Date: Thu, 4 Apr 2024 22:23:15 +0200 Subject: [PATCH] fix: comply with vatsim connect schema See https://vatsim.dev/api/connect-api/get-user for additional details regarding the VATSIM Connect schema. This adds a "token_valid" field which, at least for certain projects, will cause exceptions during schema strict validation. The field doesn't serve any purpose beyond successfully validating for third-party clients interested in using Handover, as any requests made to the /api/user endpoint should be (or must be?) successfully authenticated for the response to be generated. These assumptions are not tested. --- app/Http/Resources/UserCollection.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/Http/Resources/UserCollection.php b/app/Http/Resources/UserCollection.php index e61ae7e..3bab7f2 100644 --- a/app/Http/Resources/UserCollection.php +++ b/app/Http/Resources/UserCollection.php @@ -66,6 +66,19 @@ public function toArray($request) { ], ], + + 'oauth' => [ + // We're not entirely sure what the purpose of this field is, at least + // not for the time being. + // + // In Handover, a client making a request to the /api/user endpoint + // isn't going to receive a valid response containing this field + // *UNLESS* the token *IS* valid. Thus, if you're seeing this, you're + // already on the other side of the airtight hatchway. + // + // Oh, and it's apparently meant to be a string. + 'token_valid' => 'true', + ], ]; } }