Overview
Implement a new Azure Function LinkedInTokenRefresherFunction with a TimerTrigger that runs on the 1st of every month at 09:00 AM and automatically refreshes the LinkedIn access token via ILinkedInAuthService, writing the new token back to Key Vault.
Depends on: #56 #57
Tasks
[Function("LinkedInTokenRefresher")]
public async Task Run(
[TimerTrigger("%LinkedInTokenRefreshSchedule%")] TimerInfo timer,
ILogger<LinkedInTokenRefresherFunction> logger)
{
logger.LogInformation("Starting LinkedIn token refresh...");
var refreshToken = await _keyVaultService.GetSecretAsync("LinkedInRefreshToken");
var (newAccessToken, newRefreshToken) = await _linkedInAuthService.RefreshTokenAsync(refreshToken);
await _keyVaultService.SetSecretAsync("LinkedInAccessToken", newAccessToken);
if (!string.IsNullOrEmpty(newRefreshToken))
await _keyVaultService.SetSecretAsync("LinkedInRefreshToken", newRefreshToken);
logger.LogInformation("LinkedIn token refreshed successfully.");
}
Acceptance Criteria
Notes
- Schedule
0 0 9 1 * * = every 1st of the month at 09:00 AM — well within the 60-day expiry window
- Use
%LinkedInTokenRefreshSchedule% (env var binding) to allow schedule override without redeploy
References
Overview
Implement a new Azure Function
LinkedInTokenRefresherFunctionwith aTimerTriggerthat runs on the 1st of every month at 09:00 AM and automatically refreshes the LinkedIn access token viaILinkedInAuthService, writing the new token back to Key Vault.Depends on: #56 #57
Tasks
src/Functions/LinkedInTokenRefresherFunction.cs:LinkedInTokenRefreshSchedule=0 0 9 1 * *(day 1 of every month at 09:00)Program.cssrc/local.settings.json.examplewithLinkedInTokenRefreshScheduleAcceptance Criteria
LinkedInAccessTokensecret in Key Vault is updated with new valueseverityLevel >= 3(triggers alert from [DEV] Implement LinkedInTokenRefresherFunction (timer trigger) #58)Notes
0 0 9 1 * *= every 1st of the month at 09:00 AM — well within the 60-day expiry window%LinkedInTokenRefreshSchedule%(env var binding) to allow schedule override without redeployReferences