accessToken :: State -> AuthCode -> Manager -> ResourceT IO HTTP.AccessToken
accessToken (State state) (AuthCode code) manager = do
    let (url, body) = accessTokenUrl' digigpostKey (sToBS code) (Just "code")
    token <- liftIO $ doJSONPostRequest manager digigpostKey url (body ++ [("state", sToBS state)])
    case token of
        Right (AccessToken at (Just rt) _ _ _) -> return $ HTTP.AccessToken at rt
        Right _ -> throwIO NotAuthenticated
        Left _ -> throwIO NotAuthenticated
accessToken :: State -> AuthCode -> Manager -> ResourceT IO HTTP.AccessToken
accessToken (State state) (AuthCode code) manager = do
    let (url, body) = accessTokenUrl' digigpostKey (sToBS code) (Just "code")
    token <- liftIO $ doJSONPostRequest manager digigpostKey url (body ++ [("state", sToBS state)])
    case token of
        Right (AccessToken at (Just rt) _ _ _) -> return $ HTTP.AccessToken at rt
        Right _ -> throwIO NotAuthenticated
        Left _ -> throwIO NotAuthenticated
accessToken (State state) (AuthCode code) manager = do
    let (url, body) = accessTokenUrl' digigpostKey (sToBS code) (Just "code")
    token <- liftIO $ doJSONPostRequest manager digigpostKey url (body ++ [("state", sToBS state)])
    case token of
        Right (AccessToken at (Just rt) _ _ _) -> return $ HTTP.AccessToken at rt
        Right _ -> throwIO NotAuthenticated
        Left _ -> throwIO NotAuthenticated