peburrows/goth

403 Forbidden whenever I try to make a token

vans163 opened this issue · 4 comments

I transferred the GCP JSON credentials to another system.

{:ok, token} = Goth.Token.for_scope("https://www.googleapis.com/auth/cloud-platform")

I'm gonna need more information than that; a 403 could mean a number of different things.

Do your credentials work on the system you transferred them from?

Yes. creds work fine on that system, i just transferred the project over and did a icloud sdk installation jst incase.

The ERTS and elixir versions are different. I am thinking maybe something is wonky. Testing more ATM..

Copied everything over to another system and it works.. testing more

Exact same code inside a different app

{:ok, token} = Goth.Token.for_scope("https://www.googleapis.com/auth/cloud-platform")
** (MatchError) no match of right hand side value: {:error, {:invalid, "<", 0}}
    (goth) lib/goth/token.ex:67: Goth.Token.from_response_json/3
    (goth) lib/goth/client.ex:54: Goth.Client.get_access_token/3
    (goth) lib/goth/token.ex:100: Goth.Token.retrieve_and_store!/2

(the < error means its sending back the 403 forbidden)

Exact same app copied to a different system

{:ok, token} = Goth.Token.for_scope("https://www.googleapis.com/auth/cloud-platform")
{:ok,
 %Goth.Token{
   expires: 1565430969,
   scope: "https://www.googleapis.com/auth/cloud-platform",
   sub: nil,
   token: "ya29.c.ElpgefafeefaaefafeaeffeaZG5j5mc2lYGDI",
   type: "Bearer"
 }}

The mix.lock files are exactly the same.

Holy shit i never use config files. its had to be called config.exs not config.ex! Possibly add an error if the config file :gothjson is not set right?