I currently and retrieving the token just fine running everything that I want to run, but I can't figure out how to "Refresh" my token. It expires after an hour. This method of retrieving the App-Only token doesn't return a refresh token.
How can I "Refresh/Update" the token?
I'm using the following method to retrieve the token:
string authority = appConfig.AuthorizationUri.Replace("common", tenantId);
AuthenticationContext authenticationContext = new AuthenticationContext(authority,false);
string certfile = Server.MapPath(appConfig.ClientCertificatePfx);
X509Certificate2 cert = new X509Certificate(certfile,appConfig.ClientCertificatePfxPassword, X509KeyStorageFlags.MachineKeySet);
ClientAssertionCertificate cac = new ClientAssertionCertificate(appConfig.ClientId, cert);
var authenticationResult = await authenticationContext.AcquireTokenAsync(resource, cac);
Just request another one. There is no refresh for app-only tokens. :)