Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The task "google_apis.auth" could not be found #10448

Open
matheuscamarques opened this issue Sep 19, 2022 · 3 comments
Open

The task "google_apis.auth" could not be found #10448

matheuscamarques opened this issue Sep 19, 2022 · 3 comments
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@matheuscamarques
Copy link

The task "google_apis.auth" could not be found

@matheuscamarques matheuscamarques added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Sep 19, 2022
@oliverswitzer
Copy link

+1, am also experiencing this issue. It seems that none of the individual google_api_XXXX mix dependencies come with this mix task, but it is clearly available in this repo. Is there a recommended way to include this mix task / a recommended dependency to point at?

@oliverswitzer
Copy link

oliverswitzer commented Sep 30, 2023

I managed to get something to work by copying this task into my local project, as well as the OAuthStrategy module that it uses... I got as far as the redirect from the OAuth flow to localhost and then it failed because I don't have a server running on localhost... makes me wonder if this mix task was ever meant to be used outside of development on this library.

I have also tried pointing at this github repo in my mix.exs to get the entire project, and cannot get past configuring the the google oauth client when trying to run the task:

defmodule GoogleDriveUploader.MixProject do
  use Mix.Project

  def project do
    [
      app: :google_drive_uploader,
      version: "0.1.0",
      elixir: "~> 1.14",
      start_permanent: Mix.env() == :prod,
      deps: deps()
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger]
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:google_apis, git: "https://github.com/googleapis/elixir-google-api"},
      {:goth, "~> 1.2.0"},
      {:oauth2, "~> 0.9"}
    ]
  end
end
# config/config.ex
import Config

config :google_apis, :oauth_client, System.get_env("GOOGLE_OAUTH_CLIENT")
config :google_apis, :oauth_secret, System.get_env("GOOGLE_OAUTH_SECRET")
❯ mix google_apis.auth https://www.googleapis.com/auth/drive
Please set the Google OAuth client id

@oliverswitzer
Copy link

oliverswitzer commented Sep 30, 2023

Ok, last update. I was able to get things working by:

  1. pointing my mix dependency at this repo instead of using the individual client repos
  2. specify a config/config.exs as I did above <-- IMPORTANT: should be .exs not .ex 🤦
  3. run mix google_apis.auth https://www.googleapis.com/auth/drive

I still think that this mix tasks should be included in all client hex packages if it's in the main README.md for all google_api clients though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants