{"id":13408715,"url":"https://github.com/markbates/goth","last_synced_at":"2025-05-13T10:49:47.335Z","repository":{"id":21901573,"uuid":"25225549","full_name":"markbates/goth","owner":"markbates","description":"Package goth provides a simple, clean, and idiomatic way to write authentication packages for Go web applications.","archived":false,"fork":false,"pushed_at":"2025-04-04T01:36:48.000Z","size":4124,"stargazers_count":5960,"open_issues_count":127,"forks_count":614,"subscribers_count":57,"default_branch":"master","last_synced_at":"2025-05-05T20:22:44.972Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://blog.gobuffalo.io/goth-needs-a-new-maintainer-626cd47ca37b","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/markbates.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null}},"created_at":"2014-10-14T20:38:12.000Z","updated_at":"2025-05-05T10:05:42.000Z","dependencies_parsed_at":"2023-02-17T22:01:25.726Z","dependency_job_id":"b794f9a6-d40f-4f5a-874b-5415fffbd987","html_url":"https://github.com/markbates/goth","commit_stats":{"total_commits":559,"total_committers":181,"mean_commits":3.088397790055249,"dds":0.9355992844364938,"last_synced_commit":"260588e82ba14930ae070a80acadcf0f75348c05"},"previous_names":[],"tags_count":73,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fgoth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fgoth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fgoth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fgoth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markbates","download_url":"https://codeload.github.com/markbates/goth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253928431,"owners_count":21985793,"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":[],"created_at":"2024-07-30T20:00:54.769Z","updated_at":"2025-05-13T10:49:47.306Z","avatar_url":"https://github.com/markbates.png","language":"Go","readme":"# Goth: Multi-Provider Authentication for Go [![GoDoc](https://godoc.org/github.com/markbates/goth?status.svg)](https://godoc.org/github.com/markbates/goth) [![Build Status](https://github.com/markbates/goth/workflows/ci/badge.svg)](https://github.com/markbates/goth/actions) [![Go Report Card](https://goreportcard.com/badge/github.com/markbates/goth)](https://goreportcard.com/report/github.com/markbates/goth)\n\nPackage goth provides a simple, clean, and idiomatic way to write authentication\npackages for Go web applications.\n\nUnlike other similar packages, Goth, lets you write OAuth, OAuth2, or any other\nprotocol providers, as long as they implement the [Provider](https://github.com/markbates/goth/blob/master/provider.go#L13-L22) and [Session](https://github.com/markbates/goth/blob/master/session.go#L13-L21) interfaces.\n\nThis package was inspired by [https://github.com/intridea/omniauth](https://github.com/intridea/omniauth).\n\n## Installation\n\n```text\n$ go get github.com/markbates/goth\n```\n\n## Supported Providers\n\n* Amazon\n* Apple\n* Auth0\n* Azure AD\n* Battle.net\n* Bitbucket\n* Box\n* ClassLink\n* Cloud Foundry\n* Dailymotion\n* Deezer\n* DigitalOcean\n* Discord\n* Dropbox\n* Eve Online\n* Facebook\n* Fitbit\n* Gitea\n* GitHub\n* Gitlab\n* Google\n* Google+ (deprecated)\n* Heroku\n* InfluxCloud\n* Instagram\n* Intercom\n* Kakao\n* Lastfm\n* LINE\n* Linkedin\n* Mailru\n* Meetup\n* MicrosoftOnline\n* Naver\n* Nextcloud\n* Okta\n* OneDrive\n* OpenID Connect (auto discovery)\n* Oura\n* Patreon\n* Paypal\n* Reddit\n* SalesForce\n* Shopify\n* Slack\n* Soundcloud\n* Spotify\n* Steam\n* Strava\n* Stripe\n* TikTok\n* Tumblr\n* Twitch\n* Twitter\n* Typetalk\n* Uber\n* VK\n* WeCom\n* Wepay\n* Xero\n* Yahoo\n* Yammer\n* Yandex\n* Zoom\n\n## Examples\n\nSee the [examples](examples) folder for a working application that lets users authenticate\nthrough Twitter, Facebook, Google Plus etc.\n\nTo run the example either clone the source from GitHub\n\n```text\n$ git clone git@github.com:markbates/goth.git\n```\nor use\n```text\n$ go get github.com/markbates/goth\n```\n```text\n$ cd goth/examples\n$ go get -v\n$ go build\n$ ./examples\n```\n\nNow open up your browser and go to [http://localhost:3000](http://localhost:3000) to see the example.\n\nTo actually use the different providers, please make sure you set environment variables. Example given in the examples/main.go file\n\n## Security Notes\n\nBy default, gothic uses a `CookieStore` from the `gorilla/sessions` package to store session data.\n\nAs configured, this default store (`gothic.Store`) will generate cookies with `Options`:\n\n```go\n\u0026Options{\n   Path:   \"/\",\n   Domain: \"\",\n   MaxAge: 86400 * 30,\n   HttpOnly: true,\n   Secure: false,\n }\n```\n\nTo tailor these fields for your application, you can override the `gothic.Store` variable at startup.\n\nThe following snippet shows one way to do this:\n\n```go\nkey := \"\"             // Replace with your SESSION_SECRET or similar\nmaxAge := 86400 * 30  // 30 days\nisProd := false       // Set to true when serving over https\n\nstore := sessions.NewCookieStore([]byte(key))\nstore.MaxAge(maxAge)\nstore.Options.Path = \"/\"\nstore.Options.HttpOnly = true   // HttpOnly should always be enabled\nstore.Options.Secure = isProd\n\ngothic.Store = store\n```\n\n## Issues\n\nIssues always stand a significantly better chance of getting fixed if they are accompanied by a\npull request.\n\n## Contributing\n\nWould I love to see more providers? Certainly! Would you love to contribute one? Hopefully, yes!\n\n1. Fork it\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Write Tests!\n4. Make sure the codebase adhere to the Go coding standards by executing `gofmt -s -w ./`\n5. Commit your changes (git commit -am 'Add some feature')\n6. Push to the branch (git push origin my-new-feature)\n7. Create new Pull Request\n","funding_links":[],"categories":["Authentication and OAuth","身份验证和OAuth","开源类库","Go","Authentication \u0026 OAuth","Authentication and Authorization","Open source library","Uncategorized","认证和OAuth授权","\u003cspan id=\"身份验证和oauth-authentication-and-auth\"\u003e身份验证和OAuth Authentication and Auth\u003c/span\u003e","认证与权限控制","Web Framework Hardening"],"sub_categories":["Auth","Contents"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbates%2Fgoth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkbates%2Fgoth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbates%2Fgoth/lists"}