How long do the new Places API session tokens last?

后端 未结 2 913
独厮守ぢ
独厮守ぢ 2020-12-03 08:20

I have a website that uses address autocomplete on multiple pages--address book, shipping address, billing address. With the billing changes releasing next month, we can co

相关标签:
2条回答
  • 2020-12-03 08:32

    As far as I can see there is no official documentation regarding session duration for Places API in Google Maps Platform. I can share some information about sessions obtained from the technical support, however, it doesn't provide exact value for session duration and it looks like Google won't reveal the exact value.

    First of all, if you use the built-in Autocomplete widget of Maps JavaScript API, it generates sessions for you automatically, so no need to worry about it.

    If you create your own widget, you should be aware that sessions do not last very long. An autocomplete session includes some Autocomplete requests (to retrieve suggestions on a place as the user types), and at most one Places Details request (to retrieve details about the place selected by the user).

    The same session token is passed to the Autocomplete and the subsequent Place Detail request.

    A session starts with the first Autocomplete request (which typically happens when the user starts typing). Typically, a Places Details call is made after the user has selected one of the Autocomplete suggestions.

    After a user has selected a place (for example, a Places Details call is made), a new session must be started, with a new session token.

    A session token cannot be used for more than one user session. If a token is reused, the session will be considered invalid and the requests will be charged as if no session token was provided.

    If session token is expired or invalidated you will be charged on the per keystroke basis. So each autocomplete request will be charged.

    I hope you find this information useful.

    0 讨论(0)
  • 2020-12-03 08:36

    As a customer of Google Maps, when we contacted their support team, an agent that worked with us told us that the timeout is 3 minutes.

    0 讨论(0)
提交回复
热议问题