{"id":15322135,"url":"https://github.com/edmartt/go-authentication-api","last_synced_at":"2025-09-04T18:12:06.317Z","repository":{"id":39648255,"uuid":"488920205","full_name":"Edmartt/go-authentication-api","owner":"Edmartt","description":"Authentication API developed in Go language","archived":false,"fork":false,"pushed_at":"2024-03-14T21:55:00.000Z","size":189,"stargazers_count":6,"open_issues_count":3,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T23:37:16.613Z","etag":null,"topics":["api-rest","go","golang","jwt","microservice","solid-principles","vertical-slice-architecture","webservice"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Edmartt.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":"2022-05-05T10:03:58.000Z","updated_at":"2024-08-13T16:48:26.000Z","dependencies_parsed_at":"2024-10-15T18:02:56.078Z","dependency_job_id":"dd5b5eab-a7fd-431f-be1f-baed15dfaf31","html_url":"https://github.com/Edmartt/go-authentication-api","commit_stats":{"total_commits":85,"total_committers":2,"mean_commits":42.5,"dds":0.02352941176470591,"last_synced_commit":"d7f75114e0c3676779dd85b22b15b906d0dab733"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Edmartt/go-authentication-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edmartt%2Fgo-authentication-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edmartt%2Fgo-authentication-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edmartt%2Fgo-authentication-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edmartt%2Fgo-authentication-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Edmartt","download_url":"https://codeload.github.com/Edmartt/go-authentication-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edmartt%2Fgo-authentication-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273650261,"owners_count":25143816,"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-09-04T02:00:08.968Z","response_time":61,"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":["api-rest","go","golang","jwt","microservice","solid-principles","vertical-slice-architecture","webservice"],"created_at":"2024-10-01T09:14:18.123Z","updated_at":"2025-09-04T18:12:06.295Z","avatar_url":"https://github.com/Edmartt.png","language":"Go","readme":"# go-authentication-api\n\nA simple authentication API.\n\n### What you can do:\n- add new users\n- sign in with your user when is already registered\n- get a JWT if authentication is successful\n\n## Running Locally\n\n```\ngit clone https://github.com/Edmartt/go-authentication-api\n```\n\n\nor ssh instead:\n\n\n```\ngit@github.com:Edmart/go-authentication-api\n```\n\n\n```\ncd go-authentication-api\n```\n\n```\ngo mod tidy\n```\n\n```\ngo run main.go\n```\n\n\n## Using\n\n**Note**\n\nThis is actually set for using with SQLite for simplicity, but you can switch this database manager for postgres if needed. Just go to internal/users/data/repository.go and change the line 10 typing **Postgres**. If you use postgres, remember to set the .env.example values according to your setup. Note that I left the `:` as part of HTTP_PORT env var value, so if you need to change this port just delete the numbers.\n\nYou can use any client you want. I'm using curl:\n\n```\ncurl -i -X POST -H \"Content-Type: application/json\" -d '{\"username\":\"shinigami\", \"password\":\"12345678\"}' http://\u003chost\u003e:\u003cport\u003e/api/v1/public/signup\n```\n\n#### Response:\n\n```\nHTTP/1.1 201 Created\nContent-Type: application/json\nDate: Sun, 29 May 2022 06:24:41 GMT\nContent-Length: 26\n\n{\"status\":\"User Created\"}\n```\n\nOnce the user is created you can sign in:\n\n```\ncurl -i -X POST -H \"Content-Type: application/json\" -d '{\"username\":\"shinigami\", \"password\":\"12345678\"}' http://\u003chost\u003e:\u003cport\u003e/api/v1/public/login\n```\n\n#### Response:\n\n```\nHTTP/1.1 200 OK\nContent-Type: application/json\nDate: Sun, 29 May 2022 06:25:17 GMT\nContent-Length: 176\n\n{\"token\":\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NTM4MDU4MTcsImlzcyI6IlNhbSBTZXBpb2wiLCJBdHRyaWJ1dGUiOiJzaGluaWdhbWkifQ.CdEL0FqZxOHAit5C6zfpcX2HuhLESDpwcKQSzlowm2s\"}\n```\n\nAfter obtaining the token, we can send it to a special endpoint that will give us the user's data as a response.\n\n```\ncurl -i -H \"Content-Type: application/json\" -H \"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NTM4MDU4MTcsImlzcyI6IlNhbSBTZXBpb2wiLCJBdHRyaWJ1dGUiOiJzaGluaWdhbWkifQ.CdEL0FqZxOHAit5C6zfpcX2HuhLESDpwcKQSzlowm2s\" http://\u003chost:port\u003e/a\npi/v1/private/users/user\n```\n\n#### Response\n\n```\nHTTP/1.1 200 OK\nContent-Type: application/json\nDate: Sun, 29 May 2022 17:44:38 GMT\nContent-Length: 201\n\n{\"id\":\"02a542e5-fbd8-46ae-b0dd-7043bb226c9f\",\"username\":\"shinigami\",\"password\":\"\",\"ID\":0,\"CreatedAt\":\"2022-05-05T07:25:37.560142-05:00\",\"UpdatedAt\":\"2022-05-05T07:25:37.560142-05:00\",\"DeletedAt\":null}\n```\n\n**Note:** The password is already hashed but even like that, we don't want to expose our password hash\n\n\n## Running Unit Test\n\n```\ngo test -v -coverprofile=coverage.out ./... ./...\n```\n\n\n## Showing Coverage in Browser\n\n```\ngo tool cover -html=coverage.out\n```\n\n## DEMO\n\nA demo application is deployed here:\n\n\n- [demo app](https://go-authentication-api.azurewebsites.net)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedmartt%2Fgo-authentication-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedmartt%2Fgo-authentication-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedmartt%2Fgo-authentication-api/lists"}