How to detect on my API sever if API request is coming from a chrome extension?

Viewed 24

I am using Laravel on my API server. I am making an API request from my chrome extension. Since I couldn't find a way to save my API auth token safely in the chrome extension and reuse it every time I want to make a request, hence I am looking for a way to identify the request on API side if the request is from my extension or not.

1 Answers

Add an extra header in the chrome extension where you are calling your Api .Add the header to api header when calling. Now in the controller use.

if ($request->hasHeader('X-Header-Name')) {
    Api call from extension ..
}

Reference Link Request Header

Related