0

I am building an API service in laravel and i need to authorize the request against the magento 2 admin token. Point is i can't find the admin token in the database. I know about the integration "rest/V1/integration/admin/token?username=&password" it isn't applicable here.

 public function handle(Request $request, Closure $next)
    {
        
        $tokenValid = DB::table('Getting Admin Token From Database')->where('token',$request->header('Authorization'))->exists();

        if (!$tokenValid) {
            return response()->json('Unauthorized', 401);
        } 

        return $next($request);    
    }

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.