elixir-google-api icon indicating copy to clipboard operation
elixir-google-api copied to clipboard

You cache the token but not the conn?

Open vans163 opened this issue 6 years ago • 0 comments

It makes the workflow a bit wierd, and requires caching the conn yourself, making the token cache useless that you made. Example

{:ok, token} = Goth.Token.for_scope("https://www.googleapis.com/auth/cloud-platform.read-only")
conn = GoogleApi.Storage.V1.Connection.new(token.token)
{:ok, response} = GoogleApi.Storage.V1.Api.Buckets.storage_buckets_list(conn, "234513")

... wait 1 hour
{:ok, new_token} = Goth.Token.for_scope("https://www.googleapis.com/auth/cloud-platform.read-only")
:error = GoogleApi.Storage.V1.Api.Buckets.storage_buckets_list(conn, "234513")

We need to recreate the connection :(.

So now we need to keep a connection cache on implementer end, so we might as well handle caching the token as well. Either cache token + conn, or cache none because it doesnt really help?

vans163 avatar Mar 28 '19 15:03 vans163