Google Cloud Storage - Trying to get an Access Token in Elixir
<p>I'm trying to use <a href="https://github.com/scrogson/oauth2" rel="nofollow">OAuth2 for Elixir</a> to get an access token to interact with the Google Cloud Storage API. I've been experimenting with the OAuth2 Playground and I can make the requests and they give me back the token. Upon doing a basic GET request (to list the buckets in the project) it all works correctly, but of course I need to get the token automatically inside my app instead of copy pasting.</p>

<pre><code>  def token do 
  client = OAuth2.Client.new([
            strategy: OAuth2.Strategy.AuthCode, #default
            client_id: "myClientID",
            client_secret: "myClientSecret",
            site: "https://www.googleapis.com",
            redirect_uri: "https%3A%2F%2Fdevelopers.google.com%2Foauthplayground" #I HAVE NO IDEA WHAT SHOULD BE HERE???
  ])

  token =
    client
    |&gt; OAuth2.Client.put_param(:code, "myAuthCode")
    |&gt; OAuth2.Client.get_token!()
</code></pre>

<p>I keep getting a "Not Found" message.</p>

<p>I'm quite confused by this, if someone could help I'd be most thankful.</p>

<p>EDIT:</p>

<p>Apparently the request should be something like this:</p>

<pre><code>https://accounts.google.com/o/oauth2/v2/auth?response_type=token&amp;client_id=myClientID&amp;nonce=someRandomStringIthink&amp;scope=https://www.googleapis.com/auth/devstorage.full_control&amp;redirect_uri=WHEREDOIGETTHIS
</code></pre>

<p>I still have no idea where to find the Redirect URI. The documentation says it should be in the developer's console.</p>