{"id":20655501,"url":"https://github.com/postmannen/authsession","last_synced_at":"2026-04-18T18:33:44.011Z","repository":{"id":57516738,"uuid":"192968957","full_name":"postmannen/authsession","owner":"postmannen","description":"Go / Golang , Google Oauth2 authentication and sessions handling.","archived":false,"fork":false,"pushed_at":"2020-03-09T19:34:59.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-09T02:50:34.305Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/postmannen.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}},"created_at":"2019-06-20T18:29:04.000Z","updated_at":"2020-03-09T19:35:01.000Z","dependencies_parsed_at":"2022-09-26T18:01:25.400Z","dependency_job_id":null,"html_url":"https://github.com/postmannen/authsession","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/postmannen/authsession","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmannen%2Fauthsession","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmannen%2Fauthsession/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmannen%2Fauthsession/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmannen%2Fauthsession/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postmannen","download_url":"https://codeload.github.com/postmannen/authsession/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmannen%2Fauthsession/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31980070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T17:30:12.329Z","status":"ssl_error","status_checked_at":"2026-04-18T17:29:59.069Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-11-16T18:11:27.431Z","updated_at":"2026-04-18T18:33:43.986Z","avatar_url":"https://github.com/postmannen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# authsession\nGo / Golang , Google Oauth2 authentication and sessions handling to use with webpages.\n\n## Oauth2\n\nOauth2 for authenticating towards Google. Will return the personalia of the user logged in.\n\nYou need to register an Oauth2 App at google cloud, with a callback similar to the one specified in the code example below.\n\nAfter registering an app at Google Cloud, you need to export environment variables like the example below\n\n```\b\nexport cookiestorekey=some-cookie-store-key-here\nexport googlekey=some-google-key-here\nexport googlesecret=some-google-secret-here\n```\n\n## Sessions\n\nUsing Gorilla Sessions for session handling, and storing all session values in a session token.\nThis token can be checked for the key `authenticated` and if true user will get access to the page requested.\n\nA wrapper function is also included, and you wrap this around the HandlerFunc you define in your http.HandleFunc statement. Example below.\n\n```Go\n    a := authsession.NewAuth(\"http://\", \"localhost\", \":8080\")\n    //Run will start the http.HandleFunc's needed for authentication.\n    //The HandleFunc's started with Run() are :\n    //http.HandleFunc(\"/login\", a.login)\n\t//http.HandleFunc(\"/logout\", a.logout)\n    //http.HandleFunc(\"/callback\", a.handleGoogleCallback)\n    //\n    //Then you can specify and use /login, /logout in your html page, and you use the /callback when you registert the callback url in the Oauth2 app at google cloud. Example of callback string for google is `http://localhost:8080/callback`\n\ta.Run()\n\n    http.HandleFunc(\"/upload\", a.IsAuthenticated(d.uploadImage))\n\n    err := http.ListenAndServe(*hostListen+*port, nil)\n\tif err != nil {\n\t\tlog.Println(\"error: ListenAndServer failed: \", err)\n\t}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostmannen%2Fauthsession","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostmannen%2Fauthsession","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostmannen%2Fauthsession/lists"}