{"id":13507429,"url":"https://github.com/mgamini/oauth2cli-elixir","last_synced_at":"2026-02-22T05:35:37.539Z","repository":{"id":25410360,"uuid":"28839365","full_name":"mgamini/oauth2cli-elixir","owner":"mgamini","description":"Simple OAuth2 client written for elixir","archived":false,"fork":false,"pushed_at":"2015-02-10T20:17:21.000Z","size":212,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-21T19:31:30.545Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mgamini.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":"2015-01-06T00:43:04.000Z","updated_at":"2022-08-15T11:12:25.000Z","dependencies_parsed_at":"2022-08-23T07:10:12.815Z","dependency_job_id":null,"html_url":"https://github.com/mgamini/oauth2cli-elixir","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mgamini/oauth2cli-elixir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgamini%2Foauth2cli-elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgamini%2Foauth2cli-elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgamini%2Foauth2cli-elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgamini%2Foauth2cli-elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgamini","download_url":"https://codeload.github.com/mgamini/oauth2cli-elixir/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgamini%2Foauth2cli-elixir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29705536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T03:17:42.375Z","status":"ssl_error","status_checked_at":"2026-02-22T03:17:31.622Z","response_time":110,"last_error":"SSL_read: 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":[],"created_at":"2024-08-01T02:00:33.394Z","updated_at":"2026-02-22T05:35:37.524Z","avatar_url":"https://github.com/mgamini.png","language":"Elixir","readme":"OAuth2Cli\n======\n\nMuch (very much) of this code is derived from [Sonny Scroggin's great OAuth2 package](https://github.com/scrogson/oauth2), but it wasn't quite fitting my needs, so I ended up making my own. There are a few key differences between them.\n\nOAuth2Cli:\n\u003e 1. Holds OAuth strategies in memory for later use\n\u003e 2. Doesn't normalize oauth responses, it simply returns them\n\u003e 3. Adds some features (using a discovery url, for example)\n\u003e 4. Is currently only able to use access codes for oauth, not user/pass\n\nIf you're looking for a simple oauth library that makes it really easy to send an access code (to Google in particular) and get a token back, this is the library you want.\n\n# Usage\nSo far, I only have one situation coded out: utilizing an access code with [Google's OAuth2 API](https://developers.google.com/accounts/docs/OAuth2)\n\n## Registration\nStart by registering an oauth strategy:\n\n### Simple example:\n* This is the same as the multiple strategies example below, it simply sets its name to :default*\n```elixir\nparams = %{\n  client_id: \"someid12345\",\n  client_secret: \"somesecret12345\",\n  redirect_uri: \"http://whatever.com/oauth\",\n  token_endpoint: \"https://www.googleapis.com/oauth2/v3/token\"\n}\nOAuth2Cli.register(params)\n# \u003e :ok\n```\n\n### Multiple strategies:\n```elixir\nparams1 = %{\n  client_id: \"someid12345\",\n  client_secret: \"somesecret12345\",\n  redirect_uri: \"http://whatever.com/oauth\",\n  token_endpoint: \"https://www.googleapis.com/oauth2/v3/token\"\n}\nparams2 = %{\n  client_id: \"someid12345\",\n  client_secret: \"somesecret12345\",\n  redirect_uri: \"http://whatever.com/oauth\",\n  token_endpoint: \"https://someotherservice.com/oauth\"\n}\nOAuth2Cli.register(:google, params1)\n# \u003e :ok\nOAuth2Cli.register(:other, params2)\n# \u003e :ok\n```\n\n### Utilizing a discovery service:\n```elixir\nparams = %{\n  client_id: \"someid12345\",\n  client_secret: \"somesecret12345\",\n  redirect_uri: \"http://whatever.com/oauth\"\n}\ndiscovery_uri = \"https://accounts.google.com/.well-known/openid-configuration\"\n\nOAuth2Cli.register(:google, params, discovery_uri)\n# \u003e :ok\n```\n\n## Authorizing Users\n```elixir\nOAuth2Cli.authorize_user(\"access_code_asdfasdfasdfasdfasdf\")\n# \u003e  {:ok,\n# \u003e   %OAuth2Cli.Response{\n# \u003e    body: %{access_token: \"asdfasdfasdfasdfsadfasdfasdf\",\n# \u003e      expires_in: 3600,\n# \u003e      id_token: \"asdfsadfsadfsadfsadfsadfsadfsadfsadfsadfasdfasdfa\",\n# \u003e      token_type: \"Bearer\"},\n# \u003e    headers: [{\"Cache-Control\", \"no-cache, no-store, max-age=0, must-revalidate\"},\n# \u003e     {\"Pragma\", \"no-cache\"}, {\"Expires\", \"Fri, 01 Jan 1990 00:00:00 GMT\"},\n# \u003e     {\"Date\", \"Mon, 05 Jan 2015 22:49:06 GMT\"}, {\"Vary\", \"Origin\"},\n# \u003e     {\"Vary\", \"X-Origin\"}, {\"Content-Type\", \"application/json; charset=UTF-8\"},\n# \u003e     {\"X-Content-Type-Options\", \"nosniff\"}, {\"X-Frame-Options\", \"SAMEORIGIN\"},\n# \u003e     {\"X-XSS-Protection\", \"1; mode=block\"}, {\"Server\", \"GSE\"},\n# \u003e     {\"Alternate-Protocol\", \"443:quic,p=0.02\"}, {\"Transfer-Encoding\", \"chunked\"}],\n# \u003e    status_code: 200\n# \u003e    }\n# \u003e  }\n```\nor\n```elixir\nOAuth2Cli.authorize_user(:strategy_name, \"codecodecode\")\n```\n","funding_links":[],"categories":["Authentication"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgamini%2Foauth2cli-elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgamini%2Foauth2cli-elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgamini%2Foauth2cli-elixir/lists"}