authorized_user token is not refresh correctly
Closed this issue · 1 comments
First of all, thank all contributors for this great lib!
I am learning Haskell, so bear with me. I encountered TokenRefreshError (Status {statusCode = 400, statusMessage = "Bad Request"}) "Failure refreshing token from accounts.google.com/o/oauth2/v2/auth" Nothing
, when I try bigquery project list.
code looks like
example :: IO BigQuery.ProjectList
example = do
lgr <- Google.newLogger Google.Debug stdout
m <- liftIO (newManager tlsManagerSettings) :: IO Manager
c <- Google.getApplicationDefault m
env <- Google.newEnvWith c lgr m <&>
(Google.envLogger .~ lgr)
. (Google.envScopes .~ BigQuery.bigQueryScope)
runResourceT . Google.runGoogle env $ Google.send BigQuery.projectsList
main :: IO ()
main = do
projects <- example
print projects
i am using authorized_user
type credential generated by gcloud auth application-default login
, i verified the credential is loaded and it is FromUser
, but the refresh endpoint got invoked is
[Client Request] {
host = accounts.google.com:443
secure = True
method = POST
timeout = ResponseTimeoutDefault
redirects = 10
path = /o/oauth2/v2/auth
query =
headers = content-type: application/x-www-form-urlencoded
but the correct endpoint should be https://www.googleapis.com/oauth2/v4/token
accord to this.
i found there is tokenRequest
and accountsRequest
functions, it seems tokenRequest
should be the right one for authorized user token, and exchange
is invoking tokenRequest
. So I cannot find where is the problem. (I tried on two MacOs machines)
I think the problem is fixed in c841a76#diff-8ee6dcddaf2c1febb920b27bc6427891.
I should update my stack to use a later version