Http request to google cloud messaging - unauthorized error


Hello, Im trying to do a http request for push notification. Below is my code,

     var req = {
        method: 'POST',
        url: '',

        headers: {
            'Content-Type': 'application/json',
                'Authorization': apiKey
        body: JSON.stringify({
	        'to' : deviceToken,
	        "data": {
	          "title": "fdsafdsa",
	          "message": "gdsa"

      console.log("Push success", resp);
      console.log("Push error", error);

As the title suggest, the request isn’t going through and am getting an unauthorized error. Any help would be greatly appreciated.