chrisleekr / yii2-angular-boilerplate

Yii2 REST API + Angular 12 Boilerplate (Frontend/Backend)

Home Page:https://yam-boilerplate.chrislee.kr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

401 Unauthorized Error

sanojsilva opened this issue · comments

I have uploaded the api on to my web server but when i send an get request to the api it gives me back 401 Unauthorized error. When i debug i can see the headers i sent from the frontend are missing in the api. This scenario works well without any issue in my local server with xampp. I have googled for a solution but none of them worked. I think this has to do something with the .htaccess file.

Hi @sanojsilva

I don't know how I help you out unless I know how I reproduce the issue.

Please provide more information or steps.

hey @chrisleekr

Check out this link my issue is similar to this.
yiisoft/yii2#6631

@sanojsilva

That issue must be resolved with my boilerplate as per https://chrislee.kr/wp/2017/01/06/missing-authroization-header-in-request/

I am not sure why you still have an issue with that.

@chrisleekr Yes but the problem is $_SERVER['REDIRECT_HTTP_AUTHORIZATION'] doesn't get created even i use the same configuration in .htaccess file

@sanojsilva umm.. I am not sure then. It must be something different in your server. I cannot reproduce in my end. Let me know if you find a solution.

@chrisleekr Okay I'll figure something out thanks

@chrisleekr Hey, I couldnt find a solution for the above matter. But i found a workaround. I changed the header name to Authorization1 when sending the request with bearer token and i checked for authorization1 header in the serverside. Thatway there is no issue. So i wanted to know that is it ok change the header name from Authorization to Authorization1.