{"id":18886681,"url":"https://github.com/supabase-community/gotrue-ex","last_synced_at":"2025-12-12T00:24:04.544Z","repository":{"id":49865415,"uuid":"328092968","full_name":"supabase-community/gotrue-ex","owner":"supabase-community","description":"An Elixir client for the GoTrue authentication service","archived":false,"fork":false,"pushed_at":"2023-09-17T12:01:59.000Z","size":67,"stargazers_count":21,"open_issues_count":3,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-04T18:50:47.596Z","etag":null,"topics":["authentication","elixir","gotrue"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/supabase-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-09T06:43:25.000Z","updated_at":"2024-08-06T06:03:55.000Z","dependencies_parsed_at":"2024-10-27T17:11:52.715Z","dependency_job_id":"8d70b835-283a-4162-90eb-21f23c3e7ab7","html_url":"https://github.com/supabase-community/gotrue-ex","commit_stats":{"total_commits":54,"total_committers":3,"mean_commits":18.0,"dds":"0.12962962962962965","last_synced_commit":"224d3af7216334ae98d6a46ebec35308aa617cb3"},"previous_names":["joshnuss/gotrue-elixir"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase-community%2Fgotrue-ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase-community%2Fgotrue-ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase-community%2Fgotrue-ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase-community%2Fgotrue-ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/supabase-community","download_url":"https://codeload.github.com/supabase-community/gotrue-ex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223647726,"owners_count":17179319,"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","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","gotrue"],"created_at":"2024-11-08T07:29:57.278Z","updated_at":"2025-10-21T18:52:10.715Z","avatar_url":"https://github.com/supabase-community.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoTrue\n\nAn Elixir client for GoTrue.\n\nGoTrue is an open source authentication service that supports many methods of authentication:\n\n- Classic email+password logins\n- Passwordless logins with magic links\n- OAUTH2 - Google, GitHub, BitBucket, GitLab, etc..\n- SAML/SSO\n\n[Documentation](https://hexdocs.pm/gotrue)\n\n# Why?\n\n[GoTrue](https://github.com/netlify/gotrue) is a way of doing authentication by delagating the work to a separate service. It has a very slim HTTP API, so less code to maintain. It's also a polyglot auth solution.\n\nIt was developed by Netlify, though this version is being developed against the [supabase fork](https://github.com/supabase/gotrue)\n\nFor many apps, [`phx_gen_auth`](https://github.com/aaronrenner/phx_gen_auth) is a great solution, but it requires a bit more work to setup and adjust. It does mean inheriting a bunch of code. For a small team, or for quick experimentation, offloading a task like auth removes a big friction and reduces time to market.\n\nIt also makes it possibile to create an Elixir [supabase](https://supabase.io) client down the road.\n\n## Installation\n\nAdd `gotrue` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:gotrue, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n### Optional\n\nIn your `config/dev.exs` \u0026 `config/prod.exs`, configure settings:\n\n```elixir\nconfig :gotrue,\n  # URL to your GoTrue instance\n  base_url: \"http://0.0.0.0:9999\",\n\n  # The project's API key\n  api_key: \"your-super-secret-operator-token\"\n\n```\n\n# Usage\n\n## Creating a user account\n\nSeveral options exist to create an account:\n\n### Password based\n\nPass credentials to `GoTrue.sign_up/1`, a new account will be created and a JWT token is returned.\n\n```elixir\nGoTrue.client(\"https://ttlzokxvatvexhtzrpsm.supabase.co/auth/v1\", \"my-supabase-project-api-key\")\n|\u003e GoTrue.sign_up(%{email: \"user@example.com\", password: \"123456\"})\n```\n\n### OAUTH2\n\nOauth is performed on the client by redirecting the user. To get the redirection URL, call `GoTrue.url_for_provider/1`:\n\n```elixir\nGoTrue.url_for_provider(:google)\nGoTrue.url_for_provider(:github)\nGoTrue.url_for_provider(:gitlab)\nGoTrue.url_for_provider(:bitbucket)\nGoTrue.url_for_provider(:facebook)\n```\n\n### Magic Link\n\nUsers can login without password, by requesting a magic link:\n\n```elixir\nGoTrue.client(\"https://ttlzokxvatvexhtzrpsm.supabase.co/auth/v1\", \"my-supabase-project-api-key\")\n|\u003e GoTrue.send_magic_link(\"user@example.com\")\n```\n\nThat sends them an email with a link to login. The link will contain the `access_token` \u0026 `refresh_token`.\n\n## Sign in\n\nIf you're using password logins, sign in a user by passing the `email` \u0026 `password` to `GoTrue.sign_in/1`, it returns a JWT\n\n```elixir\nGoTrue.client(\"https://ttlzokxvatvexhtzrpsm.supabase.co/auth/v1\", \"my-supabase-project-api-key\")\n|\u003e GoTrue.sign_in(%{email: \"user@example.com\", password: \"12345\"})\n```\n\n## Refreshing JWT\n\nEach JWT expires based on your GoTrue server's settings. To refresh it, pass the `refresh_token` to `GoTrue.refresh_access_token/1`\n\n```elixir\n# first get an access token, there are many ways:\n\n# via sign up\n%{access_token: jwt, refresh_token: refresh_token} = GoTrue.sign_up(...)\n\n# or via login\n%{access_token: jwt, refresh_token: refresh_token} = GoTrue.sign_in(...)\n\n# or via a redirection from an oauth provider\ndef controller_action(conn, %{access_token: jwt, refresh_token: refresh_token}) do\n  # put in session\nend\n\n# refresh it before it expires\n%{access_token: new_jwt} = GoTrue.refresh_access_token(refresh_token)\n```\n\n## Sign out\n\nTo revoke a JWT, call `GoTrue.sign_out/1`\n\n```elixir\nGoTrue.sign_out(jwt)\n```\n\n## Getting user info\n\nThe user's info can be accessed by calling `GoTrue.get_user/1` with their current JWT:\n\n```elixir\nGoTrue.get_user(jwt)\n```\n\n## Updating user info\n\nUsing a JWT, the user's data can be updated by calling `GoTrue.update_user/2`\n\n```elixir\nGoTrue.update_user(jwt, %{data: %{favorite_language: \"elixir\"}})\n```\n\n## Invitations\n\nUsers can be invited by passing their email address to `GoTrue.invite/1`, this sends them an email with a completion link.\n\n```elixir\nGoTrue.invite(%{email: \"user@example.com\"})\n```\n\n## Settings\n\nTo view the server's auth settings, call `GoTrue.settings()`\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupabase-community%2Fgotrue-ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsupabase-community%2Fgotrue-ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupabase-community%2Fgotrue-ex/lists"}