on develop help sign in
Create a token request to exhange authorization code with token.
08f9196David Tulig
gogol/src/Network/Google/Auth/InstalledApplication.hs+1−1
@@ -109,7 +109,7 @@ exchangeCode :: (MonadIO m, MonadCatch m)
109 -> Manager
109 -> Manager
110 -> m (OAuthToken s)
110 -> m (OAuthToken s)
111exchangeCode c n = refreshRequest $
111exchangeCode c n = refreshRequest $
112− accountsRequest
112+ tokenRequest
113 { Client.requestBody = textBody $
113 { Client.requestBody = textBody $
114 "grant_type=authorization_code"
114 "grant_type=authorization_code"
115 <> "&client_id=" <> toQueryParam (_clientId c)
115 <> "&client_id=" <> toQueryParam (_clientId c)
gogol/src/Network/Google/Internal/Auth.hs+12
@@ -260,6 +260,18 @@ accountsRequest = Client.defaultRequest
260 ]
260 ]
261 }
261 }
262
262
263+tokenRequest :: Client.Request
264+tokenRequest = Client.defaultRequest
265+ { Client.host = "www.googleapis.com"
266+ , Client.port = 443
267+ , Client.secure = True
268+ , Client.method = "POST"
269+ , Client.path = "/oauth2/v4/token"
270+ , Client.requestHeaders =
271+ [ (hContentType, "application/x-www-form-urlencoded")
272+ ]
273+ }
274+
263refreshRequest :: (MonadIO m, MonadCatch m)
275refreshRequest :: (MonadIO m, MonadCatch m)
264 => Client.Request
276 => Client.Request
265 -> Logger
277 -> Logger