Closed dannypsnl closed 2 years ago
Could you give some more context? What did you expect to happen and what actually happened? 1.3 has different API than the deprecated 1.2 API but the latter is still there.
I found I cannot upload files to cloud storage with above changes, sorry that I find more useful context here.
It seems it worked correctly on Goth v1.2 but not on v1.3? Please provide two snippets so I could run this locally:
Mix.install(
[
{:goth, "~> 1.2.0"}
],
config: [
goth: [
# ... of course please keep credentials confidential.
]
]
)
Goth.Token.fetch(...)
Mix.install([
{:goth, "~> 1.3.0-rc.3"}
])
{:ok, _} = Goth.start_link(name: MyApp.Goth, ...)
Goth.fetch(MyApp.Goth)
I'm gonna close this in the meantime but please feel free to continue the discussion here.
It seems it worked correctly on Goth v1.2 but not on v1.3?
Yes, I already found these two versions give two different tokens back to me, where version 1.3 didn't work.
Mix.install(
[
{:goth, "~> 1.2.0"}
]
)
{:ok, token} = Goth.Token.for_scope("https://www.googleapis.com/auth/datastore")
IO.inspect(token)
Mix.install([
{:goth, "~> 1.3.0-rc.3"},
{:hackney, "~> 1.17"}
])
credentials = "GOOGLE_APPLICATION_CREDENTIALS" |> System.fetch_env!() |> File.read!() |> Jason.decode!()
source = {:service_account, credentials, scopes: ["https://www.googleapis.com/auth/datastore"]}
{:ok, _} = Goth.start_link(name: MyApp.Goth, source: source)
{:ok, token} = Goth.fetch(MyApp.Goth)
IO.inspect(token)
Update! I finally figure out the problem, I didn't notice old code's scope has more than one. My fault, thanks for your help.
I switch to
1.3-rc
and it didn't work as1.2
setup
usage