{"id":26739426,"url":"https://github.com/rickh94/go-pa-client","last_synced_at":"2025-03-28T04:28:55.688Z","repository":{"id":179969527,"uuid":"664022120","full_name":"rickh94/go-pa-client","owner":"rickh94","description":"Purple Auth client library for go","archived":false,"fork":false,"pushed_at":"2023-07-12T16:29:32.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-21T15:42:26.654Z","etag":null,"topics":["authentication","golang","passwordless","security","service","web"],"latest_commit_sha":null,"homepage":"https://purpleauth.com","language":"Go","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/rickh94.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-08T17:51:11.000Z","updated_at":"2023-07-18T09:36:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"8d521d9a-49fc-4678-9d47-4fb9c56bcaa4","html_url":"https://github.com/rickh94/go-pa-client","commit_stats":null,"previous_names":["rickh94/go-pa-client"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickh94%2Fgo-pa-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickh94%2Fgo-pa-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickh94%2Fgo-pa-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickh94%2Fgo-pa-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rickh94","download_url":"https://codeload.github.com/rickh94/go-pa-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245969585,"owners_count":20702248,"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","golang","passwordless","security","service","web"],"created_at":"2025-03-28T04:28:54.997Z","updated_at":"2025-03-28T04:28:55.669Z","avatar_url":"https://github.com/rickh94.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Purple Auth Client (Go)\n[![Go Reference](https://pkg.go.dev/badge/pkgs.go.dev/github.com/rickh94/go-pa-client.svg)](https://pkg.go.dev/pkgs.go.dev/github.com/rickh94/go-pa-client)\n\nAn async python client for my [\"Purple Auth\"\nmicroservice](https://purpleauth.com).\n\nThe basics are outlined below, or you can [look at an example](https://github.com/rickh94/go-pa-client/tree/main/example)\n\n\n### initialization\n\nCreate an account and application on [purpelauth.com](https://purpleauth.com),\nthen initialize the client with those values. You should store the api key in an\nenvironment variable, but the app id is a public value, not a secret.\n\n```go\nimport (\n    purpleauth \"github.com/rick94/go-pa-client\"\n)\n\nfunc main() {\n    client := purpleauth.NewClient(\"https://purpleauth.com\", \"My-App-ID\", \"My-API-Key\")\n}\n```\n\nYou will initially be limited to 500 authentications per app, but you can email\nme to have that increased.\n\n## Routes Covered\n\n### /otp/request/\n\nStart otp authentication flow with server. This will send a one time code to\nthe user's email.\n\n```go\nif err := client.Authenticate(\"test@example.com\", \"otp\"); err != nil {\n    log.Fatal(err)\n}\n```\n\n### /otp/confirm/\n\nComplete authentication with email and generated code submitted by the user.\n\n```go\ntoken, err := client.SubmitCode(\"test@example.com\", \"123456\")\n```\n\n### /token/verify/\n\nSend idToken to server for verification.\n\n```go\nclaims, err := client.VerifyTokenRemote(idTokenFromClient)\n```\n\nYou should prefer to verify tokens locally using the `VerifyToken` function, but\nthis is provided as a convenience and sanity check.\n\n### /token/refresh/\n\nRequest a new ID Token from the server using a refresh token\n\n```go\nnewToken, err := client.Refresh(refreshTokenFromClient)\n```\n\n\n### /app/\n\nGet more info about this app from the server.\n\n```go\ninfo = client.GetAppInfo()\n```\n\n\n### /magic/request/\n\nStart authentication using magic link flow.\n\n```go\nif err := client.Authenticate(\"test@example.com\", \"otp\"); err != nil {\n    log.Fatal(err)\n}\n```\n\n\n## Local Verification\n\nVerify and decode an ID Token on directly in the app without having to\ncall out every time\n\n```go\nclaims, err := client.VerifyToken(idTokenFromClient)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickh94%2Fgo-pa-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickh94%2Fgo-pa-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickh94%2Fgo-pa-client/lists"}