Private/Assert-DuneSession.ps1
|
function Assert-DuneSession { [CmdletBinding()] param () if (-not $DuneSession) { Load-DuneSession } if (-not $DuneSession) { throw "You are not authenticated. Please run Connect-Dune." } if ($DuneSession.ExpiryDate -and (Get-Date) -ge $DuneSession.ExpiryDate) { if ($DuneSession.Type -eq 'SocialLogin') { if ($DuneSession.Type -eq 'SocialLogin' -and $script.Session.RefreshToken) { Refresh-JwtToken } } else { throw "Session expired. Please use Connect-Dune to reauthenticate" } } } |