Getting Status 401 Unauthenticated while calling app store connects api

I am using Laravel with “firebase/php-jwt library. [using php 7.2]” package. token created successfully but not authorizing me while calling App Store Connect Api Showing this.

{
	"errors": [{
		"status": "401",
		"code": "NOT_AUTHORIZED",
		"title": "Authentication credentials are missing or invalid.",
		"detail": "Provide a properly configured and signed bearer token, and make sure that it has not expired. Learn more about Generating Tokens for API Requests https://developer.apple.com/go/?id=api-generating-tokens"
	}]
}

Here is my code for generating JWT Token

        $key = "file://".base_path('SubscriptionKey_RK32ULDPQ5.p8'); 

        $header = [
            'alg' => 'ES256',
            'kid' => env('APP_STORE_KEY_IDENTIFIER'),
            'typ' => 'JWT',
        ];

        $payload = [
            'iss' => env('APP_STORE_ISSUER_ID'),
            'iat' => \Carbon\Carbon::now()->timestamp,
            'exp' => \Carbon\Carbon::now()->addMinute(60)->timestamp,
            'aud' => 'appstoreconnect-v1',
            'bid' => 'com.techswivel.qthemusic.staging',
        ];

        return JWT::encode($payload, $key, 'ES256', env('APP_STORE_KEY_IDENTIFIER'), $header);
Getting Status 401 Unauthenticated while calling app store connects api
 
 
Q