@@ -35,7 +35,6 @@ module Network.Google.Auth
3535 -- ** Thread-safe Storage
3636 , Store
3737 , initStore
38− , refreshStore
3938 , retrieveAuthFromStore
4039
4140 , Auth (..)
@@ -128,27 +127,6 @@ initStore :: (MonadIO m, MonadCatch m, AllowScopes s)
128127 -> m (Store s)
129128initStore c l m = exchange c l m >>= fmap Store . liftIO . newMVar
130129
131−-- | Refresh an 'OAuthToken' if it was expired.
132−-- Otherwise, keep original one.
133−refreshStore :: (MonadIO m, MonadCatch m, AllowScopes s)
134− => Store s
135− -> Logger
136− -> Manager
137− -> m (Store s)
138−refreshStore ss@(Store s) l m = do
139− x <- retrieveAuthFromStore ss
140− mx <- validate x
141− if mx
142− then pure ss
143− else liftIO . modifyMVar s $ \y -> do
144− my <- validate y
145− if my
146− then pure (y, ss)
147− else do
148− z <- refresh y l m
149− tt <- fmap Store . liftIO . newMVar $ z
150− pure (z, tt)
151−
152130-- | Retrieve auth from storage
153131retrieveAuthFromStore :: (MonadIO m, MonadCatch m, AllowScopes s)
154132 => Store s