我正在实施 Obelisk OAuth 并遇到 2 个问题。
- 尝试实现此功能时:https ://github.com/obsidiansystems/obelisk-oauth/blob/master/example/backend/src/Backend.hs
我正进入(状态:
backend/src/Backend.hs:15:1: error:
Could not find module ‘Network.HTTP.Client.TLS’
Perhaps you meant
Network.HTTP.Client (from http-client-0.6.4)
Network.HTTP.Client.Body
Network.HTTP.Client.Core
Use -v to see a list of the files searched for.
|
15 | import qualified Network.HTTP.Client.TLS as Https
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, two modules loaded.
我在我的 backend.cabal 中有这个构建取决于:
, http-client
, http-client-tls
当我尝试错误消息提示的其他模块时,它不包含此页面所需的功能。
- 当我尝试实现这一点时:https ://github.com/obsidiansystems/obelisk-oauth/blob/master/example/frontend/src/Frontend.hs
使用此代码:
FrontendRoute_Main -> do
elClass "div" "content" $ do
let r = AuthorizationRequest
{ _authorizationRequest_responseType = AuthorizationResponseType_Code
, _authorizationRequest_clientId = "fake-id"
, _authorizationRequest_redirectUri = Just BackendRoute_OAuth
, _authorizationRequest_scope = []
, _authorizationRequest_state = Just "none"
}
grantHref = authorizationRequestHref "https://app.asana.com/-/oauth_authorize" route checkedEncoder r
elAttr "a" ("href" =: grantHref) $ text "Authorize with Asana"
我收到此错误:
frontend/src/Frontend.hs:360:96-100: error:
Variable not in scope: route :: T.Text
|
360 | grantHref = authorizationRequestHref "https://app.asana.com/-/oauth_authorize" route
checkedEncoder r
| ^^^^^
(即route
函数。)
我不知道如何导入这个。我看了看ob hoogle
它说Snap.Core
,但我无法成功导入。
我在哪里获得路线?
这些是我的进口:
import Control.Monad
import qualified Data.Text as T
-- import qualified Data.Text.Encoding as TE
import Language.Javascript.JSaddle (eval, liftJSM)
import Data.Map ((!))
import Obelisk.Frontend
import Obelisk.Configs (getConfigs)
import Obelisk.Route (R)
import Obelisk.Route.Frontend
import Obelisk.Generated.Static
import Obelisk.OAuth.Authorization (AuthorizationRequest (..), AuthorizationResponseType (..), authorizationRequestHref)
import Reflex.Dom.Core
import Common.Route
import Common.DataModel
import qualified Data.Map as Map
import Data.Maybe (fromJust)
import Data.Monoid((<>))