Custom Headers #299
-
Hi there, I want to ask, is there a way for me to put custom header in security in AppServiceProvider ? Currently, im using 2 layer of Auth, First one is using Sanctum and second was using App auth. So, i want to put the custom headers somewhere near the Token authenticated. Is it possible ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
hi, i add custom header with extension. use Dedoc\Scramble\Support\RouteInfo;
use Dedoc\Scramble\Support\Generator\Schema;
use Dedoc\Scramble\Support\Generator\Operation;
use Dedoc\Scramble\Support\Generator\Parameter;
use Dedoc\Scramble\Extensions\OperationExtension;
use Dedoc\Scramble\Support\Generator\Types\StringType;
class AddCustomHeader extends OperationExtension
{
public function handle(Operation $operation, RouteInfo $routeInfo)
{
$operation->addParameters([
Parameter::make('X-custom-id', 'header')
->setSchema(
Schema::fromType(new StringType())
)
->required(true)
->example("925fdfe2-745c-45d4-aaaf-40f3455c0510")
]);
}
} |
Beta Was this translation helpful? Give feedback.
-
@mojtabasoori Its worked! Thanks. For those of you who want to add the same thing, you need to add this as extensions in scramble.php config files. |
Beta Was this translation helpful? Give feedback.
hi,
i add custom header with extension.