{"id":32171172,"url":"https://github.com/xingxing/gotham","last_synced_at":"2026-02-20T16:01:30.310Z","repository":{"id":34944324,"uuid":"192493755","full_name":"xingxing/gotham","owner":"xingxing","description":"GCP authentication ","archived":false,"fork":false,"pushed_at":"2022-08-02T03:24:12.000Z","size":36,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-21T17:51:11.426Z","etag":null,"topics":["elixir","gcp"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/gotham","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xingxing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-18T08:00:00.000Z","updated_at":"2024-12-06T07:53:10.000Z","dependencies_parsed_at":"2022-09-16T00:11:04.448Z","dependency_job_id":null,"html_url":"https://github.com/xingxing/gotham","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/xingxing/gotham","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xingxing%2Fgotham","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xingxing%2Fgotham/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xingxing%2Fgotham/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xingxing%2Fgotham/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xingxing","download_url":"https://codeload.github.com/xingxing/gotham/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xingxing%2Fgotham/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29656589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","gcp"],"created_at":"2025-10-21T17:43:37.964Z","updated_at":"2026-02-20T16:01:30.304Z","avatar_url":"https://github.com/xingxing.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/xingxing/gotham/tree/master.svg?style=svg)](https://circleci.com/gh/xingxing/gotham/tree/master)\n\n# Gotham\n\n*Support multiple GCP service account*\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"230\" height=\"230\" src=\"https://user-images.githubusercontent.com/120734/60244733-9a01ef80-98ed-11e9-91cd-54e0b864f82f.png\" alt=\"gotham city\"\u003e\n\u003c/p\u003e\n\nGoogle + Auth + Batman = Gotham\n\n[](https://user-images.githubusercontent.com/120734/60244733-9a01ef80-98ed-11e9-91cd-54e0b864f82f.png)\n\n## Installation\n\n1. Add Gotham to you mix.exs\n```elixir\ndef deps do\n  [\n    {:gotham, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n2. Configure service accounts\n```elixir\nconfig :gotham,\n  default_account: :account1,\n  accounts: [\n    {:account1, file_path: \"path/to/google/json/creds.json\"},\n    {:account2, file_path: \"path/to/google/json/creds.json\"}\n    {:account3, env_var: \"GOOGLE_APPLICATION_CREDENTIALS\"},\n    {:account4, content: \"\"\"\n      {\n        \"type\": \"service_account\",\n        \"project_id\": \"fake_project\",\n        \"private_key_id\": \"46900d88664ebba4eb08f745b365254e2b0625ab\",\n        ...\n      }\n    \"\"\"\n    }\n```\n\n\n## Usage\n\n```elixir\n# Use default account\n{:ok, token} = Gotham.for_scope(\"https://www.googleapis.com/auth/pubsub\")\n\n%Gotham.Token{\n  project_id: \"test\",\n  access_token: \"TOKEN\",\n  account_name: :account1,\n  expire_at: 1561090622,\n  scope: \"https://www.googleapis.com/auth/pubsub\",\n  token_type: \"Bearer\"\n}\n\n# Change acocunt\n\nGotham.put_account_name(:account2)\nGotham.for_scope(\"https://www.googleapis.com/auth/pubsub\")\n\n{:ok,\n %Gotham.Token{\n   project_id: \"test\",\n   access_token: \"TOKEN\",\n   account_name: :account2,\n   expire_at: 1561092261,\n   scope: \"https://www.googleapis.com/auth/pubsub\",\n   token_type: \"Bearer\"\n }}\n\n# Run a function with a specific account\n\nGotham.with_account_name(:account2, fn -\u003e\n  Gotham.for_scope(\"https://www.googleapis.com/auth/pubsub\")\nend)\n\n{:ok,\n %Gotham.Token{\n   project_id: \"test\",\n   access_token: \"TOKEN\",\n   account_name: :account2,\n   expire_at: 1561092261,\n   scope: \"https://www.googleapis.com/auth/pubsub\",\n   token_type: \"Bearer\"\n }}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxingxing%2Fgotham","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxingxing%2Fgotham","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxingxing%2Fgotham/lists"}