Authorization Error

I’m facing an error on passing authorization header, In one request I’m able to generate token but when I’m using this token in another call for any functionality. It gives me an error
" You are not authorized to access that location".

I have also changed the .htaccess file code in webroot by adding this code but it not work for me.
This is my .htaccess file code.

RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L]

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

A small help is highly appreciable.
  1. Which CakePHP version are you using?
  2. What are you using for authentication?

Also please share some code to let us know what and how you are doing?

I’m using 3.8 CakePhp version.

I have implemented this tutorial.

This approach or code is working on my local and test server but, its not working on live server.

The API is working to generate token, but not working where I have to send token in authorization header.

Is there any other .htaccess rules that might be conflicting with? Have you checked it?

Not conflicting at that time