{"action":"created","issue":{"url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/1575","labels_url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/1575/labels{/name}","comments_url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/1575/comments","events_url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/1575/events","html_url":"https://github.com/postmanlabs/postman-app-support/issues/1575","id":118192514,"number":1575,"title":"Automatically setting request - headers in pre-request script","user":{"login":"mrudult","id":3005378,"avatar_url":"https://avatars.githubusercontent.com/u/3005378?v=3","gravatar_id":"","url":"https://api.github.com/users/mrudult","html_url":"https://github.com/mrudult","followers_url":"https://api.github.com/users/mrudult/followers","following_url":"https://api.github.com/users/mrudult/following{/other_user}","gists_url":"https://api.github.com/users/mrudult/gists{/gist_id}","starred_url":"https://api.github.com/users/mrudult/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrudult/subscriptions","organizations_url":"https://api.github.com/users/mrudult/orgs","repos_url":"https://api.github.com/users/mrudult/repos","events_url":"https://api.github.com/users/mrudult/events{/privacy}","received_events_url":"https://api.github.com/users/mrudult/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-21T11:55:46Z","updated_at":"2015-11-21T12:01:10Z","closed_at":null,"body":"I've authentication mechanism set up in an application. After authentication all subsequent requests needs a token to be set in header.\r\n\r\nI want to run a collection which will automatically set such a header before each request.\r\n\r\nHow is it possible? \r\nCurrently in the pre-request scripts the `request` object is `read-only`"},"comment":{"url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/comments/158634146","html_url":"https://github.com/postmanlabs/postman-app-support/issues/1575#issuecomment-158634146","issue_url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/1575","id":158634146,"user":{"login":"abhijitkane","id":681190,"avatar_url":"https://avatars.githubusercontent.com/u/681190?v=3","gravatar_id":"","url":"https://api.github.com/users/abhijitkane","html_url":"https://github.com/abhijitkane","followers_url":"https://api.github.com/users/abhijitkane/followers","following_url":"https://api.github.com/users/abhijitkane/following{/other_user}","gists_url":"https://api.github.com/users/abhijitkane/gists{/gist_id}","starred_url":"https://api.github.com/users/abhijitkane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhijitkane/subscriptions","organizations_url":"https://api.github.com/users/abhijitkane/orgs","repos_url":"https://api.github.com/users/abhijitkane/repos","events_url":"https://api.github.com/users/abhijitkane/events{/privacy}","received_events_url":"https://api.github.com/users/abhijitkane/received_events","type":"User","site_admin":false},"created_at":"2015-11-21T12:01:10Z","updated_at":"2015-11-21T12:01:10Z","body":"You'll need to add the header as an global variable in each request, and have the first request set the variable (https://www.getpostman.com/docs/environments).\r\n\r\nYou can use `{{authHeader}}` in all requests, and use `postman.setGlobalVariable(\"authHeader\", \"1234\");` in the first request."}}