[web-devel] Yesod: Issue with getAuthId never getting executed

Michael Snoyman michael at snoyman.com
Fri Jun 10 11:15:15 CEST 2011


Hi Mathew,

Sorry for the delay in response, I haven't had a chance until today to
get set up with Facebook again. Some other users reported issues with
the authenticate package, which have hopefully been solved. Can you
try running your tests again using the latest authenticate and letting
me know if you still have issues?

I put a sample facebook app in the repo, but it's using a newer
version of yesod-auth that hasn't been released yet. It still might be
helpful though to have a look:

https://github.com/snoyberg/yesod-auth/blob/master/facebook.hs

MIchael

On Wed, Jun 1, 2011 at 9:04 AM, Mathew de Detrich <deteego at gmail.com> wrote:
> 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
> facebook)).
> 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)
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel
>
>



More information about the web-devel mailing list