I am working on implementing Obelisk OAuth and running into 2 problems.
- When trying to implement this: https://github.com/obsidiansystems/obelisk-oauth/blob/master/example/backend/src/Backend.hs
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:
, http-client
, http-client-tls
When I try the other modules the error message suggests, it does not contain the functions this page needs.
- When I try to implement this: https://github.com/obsidiansystems/obelisk-oauth/blob/master/example/frontend/src/Frontend.hs
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
| ^^^^^
(I.e. the 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.
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((<>))