[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Auth Library Client - Class AuthTokenMiddleware (1.47.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.47.1 (latest)](/php/docs/reference/auth/latest/Middleware.AuthTokenMiddleware)\n- [1.47.0](/php/docs/reference/auth/1.47.0/Middleware.AuthTokenMiddleware)\n- [1.46.0](/php/docs/reference/auth/1.46.0/Middleware.AuthTokenMiddleware)\n- [1.45.2](/php/docs/reference/auth/1.45.2/Middleware.AuthTokenMiddleware) \nReference documentation and code samples for the Google Auth Library Client class AuthTokenMiddleware.\n\nAuthTokenMiddleware is a Guzzle Middleware that adds an Authorization header\nprovided by an object implementing FetchAuthTokenInterface.\n\nThe FetchAuthTokenInterface#fetchAuthToken is used to obtain a hash; one of\nthe values value in that hash is added as the authorization header.\n\nRequests will be accessed with the authorization header:\n\n'authorization' 'Bearer\n\n\nNamespace\n---------\n\nGoogle \\\\ Auth \\\\ Middleware\n\nMethods\n-------\n\n### __construct\n\nCreates a new AuthTokenMiddleware.\n\n### __invoke\n\nUpdates the request with an Authorization header when auth is 'google_auth'.\n\nuse Google\\\\Auth\\\\Middleware\\\\AuthTokenMiddleware;\nuse Google\\\\Auth\\\\OAuth2;\nuse GuzzleHttp\\\\Client;\nuse GuzzleHttp\\\\HandlerStack;\n\n$config = \\[..\n\n\n$client = new Client(\\[\n'handler' =\\\u003e $stack,\n'base_uri' =\\\u003e '\u003chttps://www.googleapis.com/taskqueue/v1beta2/projects/\u003e',\n'auth' =\\\u003e 'google_auth' // authorize all requests\n\\]);\n\n$res = $client-\\\u003eget('myproject/taskqueues/myqueue');"]]