-get-gcp-jwt: returns time of expiry

Couldn't bring myself to pass in a relative date without a base, so we
instead pass now into get-access-token, and return the time of expiry.
This commit is contained in:
J 2021-02-23 22:40:05 +00:00
parent b0bb659f12
commit 9f43fef85d

View File

@ -36,7 +36,8 @@
'https://www.googleapis.com/auth/cloud-platform' 'https://www.googleapis.com/auth/cloud-platform'
aud now.bowl aud now.bowl
== ==
;< p=[tok=@t exp=@dr] bind:m (get-access-token sot aud) ;< p=[tok=@t exp=@da] bind:m
(get-access-token sot aud now.bowl)
(pure:m !>(p)) (pure:m !>(p))
:: ::
++ read-setting ++ read-setting
@ -98,8 +99,8 @@
:: https://developers.google.com/identity/protocols/oauth2/service-account :: https://developers.google.com/identity/protocols/oauth2/service-account
:: ::
++ get-access-token ++ get-access-token
|= [jot=@t url=@t] |= [jot=@t url=@t now=@da]
=/ m (strand ,[@t @dr]) ^- form:m =/ m (strand ,[@t @da]) ^- form:m
;< ~ bind:m ;< ~ bind:m
%: send-request:strandio %: send-request:strandio
method=%'POST' method=%'POST'
@ -137,5 +138,5 @@
== ==
?> =('Bearer' typ) ?> =('Bearer' typ)
%- pure:m %- pure:m
[tok exp] [tok (add exp now)]
-- --