on develop help sign in
Adding /computeMetadata/v1/ path prefix to metadata token refresh requests
5c7350cBrendan Hay
gogol/src/Network/Google/Auth/ServiceAccount.hs+2−3
@@ -44,7 +44,7 @@ maxTokenLifetime = 3600
44-- | Obtain an 'OAuthToken' from the local instace metadata
44-- | Obtain an 'OAuthToken' from the local instace metadata
45-- using the specific 'ServiceId'.
45-- using the specific 'ServiceId'.
46--
46--
47−-- For example: @http:\/\/169.254.169.254\/instance\/service-accounts\/default\/token@
47+-- For example: @http:\/\/metadata.google.internal\/computeMetadata\/v1\/instance\/service-accounts\/default\/token@
48-- will be retrieved if the given 'ServiceId' is @\"default\"@.
48-- will be retrieved if the given 'ServiceId' is @\"default\"@.
49metadataToken :: (MonadIO m, MonadCatch m)
49metadataToken :: (MonadIO m, MonadCatch m)
50 => ServiceId
50 => ServiceId
@@ -53,7 +53,7 @@ metadataToken :: (MonadIO m, MonadCatch m)
53 -> m (OAuthToken s)
53 -> m (OAuthToken s)
54metadataToken s = refreshRequest $
54metadataToken s = refreshRequest $
55 metadataRequest
55 metadataRequest
56− { Client.path = "instance/service-accounts/"
56+ { Client.path = "/computeMetadata/v1/instance/service-accounts/"
57 <> Text.encodeUtf8 (toQueryParam s)
57 <> Text.encodeUtf8 (toQueryParam s)
58 <> "/token"
58 <> "/token"
59 }
59 }
@@ -76,7 +76,6 @@ authorizedUserToken u r = refreshRequest $
76 <> "&refresh_token=" <> toQueryParam (fromMaybe (_userRefresh u) r)
76 <> "&refresh_token=" <> toQueryParam (fromMaybe (_userRefresh u) r)
77 }
77 }
78
78
79−
80-- | Obtain an 'OAuthToken' from @https://accounts.google.com/o/oauth2/token@
79-- | Obtain an 'OAuthToken' from @https://accounts.google.com/o/oauth2/token@
81-- by signing and sending a JSON Web Token (JWT) using the supplied 'ServiceAccount'.
80-- by signing and sending a JSON Web Token (JWT) using the supplied 'ServiceAccount'.
82serviceAccountToken :: (MonadIO m, MonadCatch m, AllowScopes s)
81serviceAccountToken :: (MonadIO m, MonadCatch m, AllowScopes s)