{"id":21500644,"url":"https://github.com/podium/simple_token_authentication","last_synced_at":"2025-10-12T06:05:16.687Z","repository":{"id":45951177,"uuid":"70854685","full_name":"podium/simple_token_authentication","owner":"podium","description":"Elixir Plug that checks for presence of a simple token for authentication","archived":false,"fork":false,"pushed_at":"2025-09-15T21:07:06.000Z","size":191,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":46,"default_branch":"master","last_synced_at":"2025-10-07T01:14:10.826Z","etag":null,"topics":["authentication","elixir","elixir-lang","phoenix","phoenix-framework","simple-auth"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/simple_token_authentication","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/podium.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-10-13T22:56:38.000Z","updated_at":"2025-09-15T21:07:09.000Z","dependencies_parsed_at":"2023-11-09T01:31:11.376Z","dependency_job_id":"6fce89e6-0ed9-416f-b7f1-058bc17ce7ea","html_url":"https://github.com/podium/simple_token_authentication","commit_stats":{"total_commits":74,"total_committers":10,"mean_commits":7.4,"dds":0.527027027027027,"last_synced_commit":"f12893eb97e80e07d4add6580a94d0c79492fc46"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/podium/simple_token_authentication","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podium%2Fsimple_token_authentication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podium%2Fsimple_token_authentication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podium%2Fsimple_token_authentication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podium%2Fsimple_token_authentication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/podium","download_url":"https://codeload.github.com/podium/simple_token_authentication/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podium%2Fsimple_token_authentication/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004825,"owners_count":26083784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["authentication","elixir","elixir-lang","phoenix","phoenix-framework","simple-auth"],"created_at":"2024-11-23T17:42:58.788Z","updated_at":"2025-10-12T06:05:16.680Z","avatar_url":"https://github.com/podium.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleTokenAuthentication\n\n[![Build Status](https://github.com/podium/simple_token_authentication/actions/workflows/ci.yml/badge.svg)](https://github.com/podium/simple_token_authentication/actions/workflows/ci.yml) [![Hex.pm](https://img.shields.io/hexpm/v/simple_token_authentication.svg)](https://hex.pm/packages/simple_token_authentication) [![Documentation](https://img.shields.io/badge/documentation-gray)](https://hexdocs.pm/simple_token_authentication)\n[![Total Download](https://img.shields.io/hexpm/dt/simple_token_authentication.svg)](https://hex.pm/packages/simple_token_authentication)\n[![License](https://img.shields.io/hexpm/l/simple_token_authentication.svg)](https://github.com/podium/simple_token_authentication/blob/master/LICENSE.md)\n## Usage\n### Phoenix Integration\n\nInside `web/router.ex` file, add plug to your pipeline like so:\n\n```elixir\ndefmodule MyApp.Router\n  use Phoenix.Router\n\n  pipeline :api do\n    plug SimpleTokenAuthentication\n  end\n\n  scope \"/\", MyApp do\n    pipe_through :api\n    get \"/hello\", HelloController, :hello\n  end\nend\n```\n## Installation\n\n1. Add `simple_token_authentication` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:simple_token_authentication, \"~\u003e 0.6.0\"}]\nend\n```\n\n2. Ensure `simple_token_authentication` is started before your application:\n\n```elixir\ndef application do\n  [applications: [:simple_token_authentication]]\nend\n```\n\n3. Configure your token in `config.exs`:\n```elixir\nconfig :simple_token_authentication,\n  token: \"your-token-here\",\n  service_tokens: [\n    service_a: \"service-a-token\",\n    service_b: \"service-b-token\"\n  ]\n```\n\n4. Configure your connecting application to pass a token in the `authorization` header, e.g.:\n```elixir\nput_header(\"authorization\", \"your-token-here\")\n```\n\n## Realm\n\nOptionally, you can add a realm to the simple auth. This allows services to use the plug multiple times with different realms\nFor example:\n\nConfigure your token under a named realm in `config.exs`:\n```elixir\nconfig :simple_token_authentication,\n  another_realm: [\n    service_tokens: [\n      service_a: \"service-a-token\",\n      service_b: \"service-b-token\"\n    ]\n  ]\n```\n\nPass that name when configuring the plug:\n```elixir\ndefmodule MyApp.Router\n  use Phoenix.Router\n\n  pipeline :api do\n    plug SimpleTokenAuthentication, auth_realm: :another_realm\n  end\n\n  scope \"/\", MyApp do\n    pipe_through :api\n    get \"/hello\", HelloController, :hello\n  end\nend\n```\n\n## Notes\n\n- Token value can be a comma-separated list of tokens\n- Specifying `service_tokens` is optional\n- Auth will succeed if token exists in *either* list (`token` or `service_tokens`)\n- Use of a service token will add \"service_name\" to `Logging.metadata`\n- Service can be identified in the conn.assigns[:simple_token_auth_service]. Will be the name of the service or :global when matching the token key\n\n## Copyright and License\n\nCopyright (c) 2025 Podium\n\nThis work is free. You can redistribute it and/or modify it under the\nterms of the MIT License. See the [LICENSE.md](./LICENSE.md) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpodium%2Fsimple_token_authentication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpodium%2Fsimple_token_authentication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpodium%2Fsimple_token_authentication/lists"}