yesodweb/authenticate — Issue #5: OpenID Steam
Author: drdo
Created: 2012-01-16 08:28:51+00:00
State: open

Hello, i'm getting Handshake Errors (presumably from TLS) when calling authenticate (getForwardUrl works fine apparently).

Below is code so you can reproduce, unfortunately this will require creating an account with ethe OpenID provider in question.

{-# LANGUAGE OverloadedStrings #-}

import qualified Data.Text.Encoding as T
import qualified Data.Text.Lazy as LT
import qualified Data.Text.Lazy.Encoding as LT

import Network.HTTP.Types
import Network.HTTP.Conduit (newManager)

import Network.Wai
import Network.Wai.Handler.Warp

import Web.Authenticate.OpenId

main = run 3000 $ \req -> do
man <- newManager
case pathInfo req of
[] -> do
url <- getForwardUrl "http://steamcommunity.com/openid" "http://localhost:3000/check"
Nothing [] man
return $ responseLBS statusFound [("Location", T.encodeUtf8 url)] ""
["check"] -> do
let query = map (\(k,v) -> (T.decodeUtf8 k, T.decodeUtf8 v))
(parseSimpleQuery $ rawQueryString req)
id <- fmap (identifier . fst) $ authenticate query man
return $ responseLBS statusOK [] . LT.encodeUtf8 . LT.fromChunks . (:[]) $ id
_ -> return $ responseLBS statusNotFound [] ""