{"id":16341557,"url":"https://github.com/psibi/yesod-auth-fb","last_synced_at":"2025-04-11T11:31:54.042Z","repository":{"id":56883159,"uuid":"84632917","full_name":"psibi/yesod-auth-fb","owner":"psibi","description":null,"archived":false,"fork":false,"pushed_at":"2020-03-22T15:13:24.000Z","size":159,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T18:57:10.514Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/psibi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-03-11T07:40:24.000Z","updated_at":"2020-03-22T15:13:27.000Z","dependencies_parsed_at":"2022-08-20T22:31:09.712Z","dependency_job_id":null,"html_url":"https://github.com/psibi/yesod-auth-fb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psibi%2Fyesod-auth-fb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psibi%2Fyesod-auth-fb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psibi%2Fyesod-auth-fb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psibi%2Fyesod-auth-fb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psibi","download_url":"https://codeload.github.com/psibi/yesod-auth-fb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248384012,"owners_count":21094657,"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-10-10T23:59:46.018Z","updated_at":"2025-04-11T11:31:53.718Z","avatar_url":"https://github.com/psibi.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"yesod-auth-fb\n---------------\n\n[![Build Status](https://dev.azure.com/psibi2000/Haskell%20Projects/_apis/build/status/psibi.yesod-auth-fb?branchName=master)](https://dev.azure.com/psibi2000/Haskell%20Projects/_build/latest?definitionId=18\u0026branchName=master)\n[![Hackage](https://img.shields.io/hackage/v/yesod-auth-fb.svg)](https://hackage.haskell.org/package/yesod-auth-fb)\n[![Stackage\nNightly](http://stackage.org/package/yesod-auth-fb/badge/nightly)](http://stackage.org/nightly/package/yesod-auth-fb)\n[![Stackage\nLTS](http://stackage.org/package/yesod-auth-fb/badge/lts)](http://stackage.org/lts/package/yesod-auth-fb)\n\nAuthentication backend for Yesod using Facebook\n\n# Demo\n\nSample code showing Facebook authentication in action:\n\n```\n{-# LANGUAGE MultiParamTypeClasses #-}\n{-# LANGUAGE QuasiQuotes #-}\n{-# LANGUAGE TemplateHaskell #-}\n{-# LANGUAGE TypeFamilies #-}\n{-# LANGUAGE OverloadedStrings #-}\n\nimport Data.Text (Text)\nimport Yesod\nimport Yesod.Auth\nimport Yesod.Facebook\nimport Yesod.Auth.Facebook.ServerSide\nimport Facebook (Credentials(..))\n\nfbclientId :: Text\nfbclientId = \"sample_fb_client_id\"\n\nfbclientSecret :: Text\nfbclientSecret = \"sample_fb_secret\"\n\ndata App =\n  App\n\nmkYesod\n  \"App\"\n  [parseRoutes|\n/ HomeR GET\n/auth AuthR Auth getAuth\n|]\n\ninstance Yesod App where\n  approot = ApprootStatic \"http://localhost:3000\"\n\ninstance YesodFacebook App where\n  fbCredentials _ = Credentials \"yesod\" fbclientId fbclientSecret\n\ninstance YesodAuth App where\n  type AuthId App = Text\n  getAuthId = return . Just . credsIdent\n  loginDest _ = HomeR\n  logoutDest _ = HomeR\n  authPlugins _ = [authFacebook [\"user_about_me\", \"email\"]]\n  -- The default maybeAuthId assumes a Persistent database. We're going for a\n  -- simpler AuthId, so we'll just do a direct lookup in the session.\n  maybeAuthId = lookupSession \"_ID\"\n\ninstance RenderMessage App FormMessage where\n  renderMessage _ _ = defaultFormMessage\n\ngetHomeR :: Handler Html\ngetHomeR = do\n  maid \u003c- maybeAuthId\n  defaultLayout\n    [whamlet|\n            \u003cp\u003eYour current auth ID: #{show maid}\n            $maybe _ \u003c- maid\n                \u003cp\u003e\n                    \u003ca href=@{AuthR LogoutR}\u003eLogout\n                    \u003ca href=@{AuthR facebookLogout}\u003eFacebook logout\n            $nothing\n                \u003cp\u003e\n                    \u003ca href=@{AuthR LoginR}\u003eGo to the login page\n        |]\n\nmain :: IO ()\nmain = warp 3000 App\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsibi%2Fyesod-auth-fb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsibi%2Fyesod-auth-fb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsibi%2Fyesod-auth-fb/lists"}