dotfiles/dot_bin/executable_oauth-refresh

14 lines
453 B
Bash

#! /bin/bash
# get an oauth access token using the refresh token
token_url="$(pass "email/$1/token_url")"
client_id="$(pass "email/$1/client_id")"
client_secret="$(pass "email/$1/client_secret")"
refresh_token="$(pass "email/$1/refresh_token")"
curl --silent \
--request POST \
--data "client_id=$client_id&client_secret=$client_secret&refresh_token=$refresh_token&grant_type=refresh_token" \
"$token_url" \
| jq -r '.access_token'