[web-devel] Yesod: Issue with getAuthId never getting executed
Mathew de Detrich
deteego at gmail.com
Wed Jun 1 08:04:58 CEST 2011
I seem to be having an issue where getAuthId (when being instantiated under
YesodAuth) is never being executed on my site, which basically prevents
the necessary data from being inserted into the database and the AuthId
being set up (or the Auth system working in general, at all). I'm not sure
if this is an issue with Haskell's lazy evaluation, browsing through the
source code I note that getAuthId is called by setCreds, which is inturn
called when you instantiate an authentication plugin (in my case I am using
I am using a simple liftIO$ putStrLn "getAuthId" inside the getAuthId to
figure out if the function is being called (and I never manage to get
Haskell to execute it). Furthermore nothing is being entered into my
database (which would happen if its called). Originally I used to think this
was due to Haskell's laziness or black magic, (I was initiating maybeAuth
but never using the variable), I then forced evaluation of maybeAuth,
obviously with no results (and maybeAuth always returns Nothing).
The actual logging into facebook and redirecting works fine.
I am using yesod-auth-0.42 with authenticate 0.9.0.1 and yesod 0.8.1
Also on another note (since I am unable to test it right now), if I wish to
get data from facebook using the graph API (in my case I am doing this
inside getAuthId as well), something like this is done?
let [(_,at)] = credsExtra creds
fbname <- liftIO $ getTextFBData at "name"
where getTextFBData is defined as
textFromJSON :: Value -> T.Text
textFromJSON v = case (fromJSON v) of
Success a -> a
Error b -> T.pack b
getTextFBData :: T.Text -> T.Text -> IO (T.Text)
getTextFBData at rq = do
let at' = AccessToken at
rqeither <- liftIO $ getGraphData at' rq
return (either (\x-> "invalid request from FB") textFromJSON rqeither)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the web-devel