title: Google Javascript API Photo getURL returns temporary URL and unable to find photo_reference
body: <p>I am using Google Autocomplete (under Maps Javascript API) in Angular 5. </p>
  
  <p>For the purpose of my website, I retrieve details of a place, which includes any available photos. For the photos, I will get the photo URL via the getURL() method.</p>
  
  <p>============</p>
  
  <p><strong>What works previously</strong></p>
  
  <p>Previously, I am able to save the url in the database and use that same url to retrieve the photos at a later date. Example of the URLs includes:</p>
  
  <p><a href="https://lh3.googleusercontent.com/p/AF1QipM3QnVu-6W-ZtoTry29MOzDt7vpWzPZAPZbBfqZ=w600-h500-k" rel="nofollow noreferrer">https://lh3.googleusercontent.com/p/AF1QipM3QnVu-6W-ZtoTry29MOzDt7vpWzPZAPZbBfqZ=w600-h500-k</a></p>
  
  <p><a href="https://lh3.googleusercontent.com/p/AF1QipPQ5imb4nzfK1TxG7KAFx2vEx1SoYXeQApA6SVX=w600-h500-k" rel="nofollow noreferrer">https://lh3.googleusercontent.com/p/AF1QipPQ5imb4nzfK1TxG7KAFx2vEx1SoYXeQApA6SVX=w600-h500-k</a></p>
  
  <p><a href="https://lh4.googleusercontent.com/-l_W16EbIqzk/WS5E5R9_VbI/AAAAAAAAnD8/ajWr1IeY7solMudnxIV21vjqmxLt8CJOACLIB/w300-h250-k" rel="nofollow noreferrer">https://lh4.googleusercontent.com/-l_W16EbIqzk/WS5E5R9_VbI/AAAAAAAAnD8/ajWr1IeY7solMudnxIV21vjqmxLt8CJOACLIB/w300-h250-k</a></p>
  
  <p>============</p>
  
  <p><strong>Situation now</strong></p>
  
  <p>However, in recent weeks, the same getURL() method returns photos that expire. I have no problem seeing the photo when I first retrieved it. As usual, I save the url to my database. However, after a few days, I am unable to retrieve the same images. Example includes:</p>
  
  <p><a href="https://maps.googleapis.com/maps/api/place/js/PhotoService.GetPhoto?1sCmRaAAAAiEX-USwjAvitgPnxuaW7stCrTkQMxyydpcmlg5IrEWnSUS5D3Z2D9evQ_n41Ght-8dr3cZtjvx4oINIEpqj4Z4fvaCyqv6xF0oPC_lw88P6FUQ7SXP2vElr61Zi568IdEhBWY_7xGFNHvdQyDqxZApR3GhS-IM17Pp8oMGlMK0FrXW310tsPCw&amp;3u2000&amp;4u1000&amp;5m1&amp;2e1&amp;key=AIzaSyAbdivx4G0igYO5yr3vTUJcQF5s8lTdXho&amp;callback=none&amp;token=96678" rel="nofollow noreferrer">https://maps.googleapis.com/maps/api/place/js/PhotoService.GetPhoto?1sCmRaAAAAiEX-USwjAvitgPnxuaW7stCrTkQMxyydpcmlg5IrEWnSUS5D3Z2D9evQ_n41Ght-8dr3cZtjvx4oINIEpqj4Z4fvaCyqv6xF0oPC_lw88P6FUQ7SXP2vElr61Zi568IdEhBWY_7xGFNHvdQyDqxZApR3GhS-IM17Pp8oMGlMK0FrXW310tsPCw&amp;3u2000&amp;4u1000&amp;5m1&amp;2e1&amp;key=AIzaSyAbdivx4G0igYO5yr3vTUJcQF5s8lTdXho&amp;callback=none&amp;token=96678</a></p>
  
  <p><a href="https://maps.googleapis.com/maps/api/place/js/PhotoService.GetPhoto?1sCmRaAAAAkz5xG6DVQSbwHyBIQIshs2FedNARq6oG0Ea6gUxvljPdnHFJqcJniD0gkd2BZQ7-IPc6FPVlYYb7G0t8K_-8hVYizZl4HGy5V1QiE4sjdWLhyWX7MnJYEA61zoup_fbpEhDWYpcVACyQ6RKsqpyS-bQKGhQw8Tg2O8rcGJfaKI0jW3T7XKAYZg&amp;3u2000&amp;4u1000&amp;5m1&amp;2e1&amp;key=AIzaSyAbdivx4G0igYO5yr3vTUJcQF5s8lTdXho&amp;callback=none&amp;token=20957" rel="nofollow noreferrer">https://maps.googleapis.com/maps/api/place/js/PhotoService.GetPhoto?1sCmRaAAAAkz5xG6DVQSbwHyBIQIshs2FedNARq6oG0Ea6gUxvljPdnHFJqcJniD0gkd2BZQ7-IPc6FPVlYYb7G0t8K_-8hVYizZl4HGy5V1QiE4sjdWLhyWX7MnJYEA61zoup_fbpEhDWYpcVACyQ6RKsqpyS-bQKGhQw8Tg2O8rcGJfaKI0jW3T7XKAYZg&amp;3u2000&amp;4u1000&amp;5m1&amp;2e1&amp;key=AIzaSyAbdivx4G0igYO5yr3vTUJcQF5s8lTdXho&amp;callback=none&amp;token=20957</a></p>
  
  <p><a href="https://maps.googleapis.com/maps/api/place/js/PhotoService.GetPhoto?1sCmRaAAAAfLQZlWahAqUSlQA5y7-NTeYLMDim6M1L_ht3_qNCSL4dBeX2VWVdhzuJXeqGcKN30XAv3WZHtY2QUXaoKV5fVGSUld2IdOKfV0bv32kEFUdgMlqou9Ij5YVaJ15mfoVcEhB-6hiiaiPS3349mCZMYOPyGhTrEZUg0XGOuBW1rsrLlpmaO9nvqg&amp;3u2000&amp;4u1000&amp;5m1&amp;2e1&amp;key=AIzaSyAbdivx4G0igYO5yr3vTUJcQF5s8lTdXho&amp;callback=none&amp;token=38662" rel="nofollow noreferrer">https://maps.googleapis.com/maps/api/place/js/PhotoService.GetPhoto?1sCmRaAAAAfLQZlWahAqUSlQA5y7-NTeYLMDim6M1L_ht3_qNCSL4dBeX2VWVdhzuJXeqGcKN30XAv3WZHtY2QUXaoKV5fVGSUld2IdOKfV0bv32kEFUdgMlqou9Ij5YVaJ15mfoVcEhB-6hiiaiPS3349mCZMYOPyGhTrEZUg0XGOuBW1rsrLlpmaO9nvqg&amp;3u2000&amp;4u1000&amp;5m1&amp;2e1&amp;key=AIzaSyAbdivx4G0igYO5yr3vTUJcQF5s8lTdXho&amp;callback=none&amp;token=38662</a></p>
  
  <p>============</p>
  
  <p><strong>What may be the problem</strong></p>
  
  <p>From the makeup of the URLs, there are obvious differences. The older URLs comes with the googleusercontent as the domain name. While the newer photos end with a token. Right now, I am still able to retrieve the older photos even though i may have added them months ago. For the new photos, it expires after a few days. </p>
  
  <p>I understand that there are solutions that require the use of photo_reference, however, I am unable to find a way to retrieve photo_reference via the javascript API I am using. I have tried to use Places Service method (new google.maps.places.PlacesService) but it returns the same getURL() method which retrieves the same temporary URL as above.</p>
  
  <p>=======================</p>
  
  <p><strong>Thus my question are</strong>:</p>
  
  <ol>
  <li><p>Does anyone know whether the change in url is intended or it may be an error from google? If it is intended, is there any way to get a permanent url that does not expire.</p></li>
  <li><p>Does anyone know how to retrieve photo_reference via the google javascript API?</p></li>
  </ol>
  
  <p>Many thanks for your help in advance. </p>