[英]Cannot find “route” and “Https” in Obelisk OAuth project
I am working on implementing Obelisk OAuth and running into 2 problems.我正在实施 Obelisk OAuth 并遇到 2 个问题。
I am getting:我正进入(状态:
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.
I have this in my backend.cabal build depends:我在我的 backend.cabal 中有这个构建取决于:
, http-client
, http-client-tls
When I try the other modules the error message suggests, it does not contain the functions this page needs.当我尝试错误消息提示的其他模块时,它不包含此页面所需的功能。
Using this code:使用此代码:
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"
I get this error:我收到此错误:
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
| ^^^^^
(Ie the route
function.) (即
route
function。)
I cannot figure out how to import this.我不知道如何导入这个。 I looked in
ob hoogle
and it said Snap.Core
but I can't import that successfully.我查看了
ob hoogle
,它说Snap.Core
但我无法成功导入。
Where do I get route?我在哪里获得路线?
These are my imports:这些是我的进口:
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((<>))
Do a Google search for Network.HTTP.Client.TLS
, and it will land you at:在 Google 上搜索
Network.HTTP.Client.TLS
,它会将您带到:
As you can see from the URL, this is the http-client-tls
package, so add that to your backend.cabal and re-start ob run
.正如您从 URL 中看到的,这是
http-client-tls
package,因此将其添加到您的 backend.cabal 并重新启动ob run
。
The reason why you didn't see this in ob hoogle
is that the Hoogle server shows only the packages already in the.cabal files of the project.你在
ob hoogle
中没有看到这个的原因是 Hoogle 服务器只显示了项目的 .cabal 文件中已经存在的包。 If also you restart ob hoogle
, after adding this new package, it will now show up in Hoogle.如果您还重新启动
ob hoogle
,在添加这个新的 package 之后,它现在将显示在 Hoogle 中。
As for the other error, you should always read the included example (the answer to your question is here ; the README only shows snippets, not complete code.至于另一个错误,您应该始终阅读包含的示例(您的问题的答案在这里;自述文件只显示片段,而不是完整的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.