Forum Discussion

OSAdmin's avatar
OSAdmin
Valued Contributor
5 years ago

we are looking for a way to refresh excel workbook with the add-in in automated fashion using VBA with excel. did anyone do it with okta sso authentication?

Originally posted by Ashok Amresh

We are looking for a way to refresh excel workbook with the add-in in automated fashion.  did anyone do it with okta sso authentication?

basically looking for VBA version of below power-shell code. has anyone ever done it? Appreciate any help.

 

$ssoToken = $xfApi.Authentication.ProcessSSOAuthenticationAndCreateToken("<server address>", "Username", "Password", [OneStream.Shared.Wcf.XFClientAuthenticationType]::ClearTextPW)
$xfLogonInfo = $xfApi.Authentication.LogonAndOpenApplication("<server address>", "username", "$ssoToken", "appname", [OneStream.Shared.Wcf.XFClientAuthenticationType]::ClearTextPW)

  • OS_Pizza's avatar
    OS_Pizza
    Contributor III

    With an Okta user you could try the following: ' Set Excel Addin object Set xfAddin = Application.COMAddIns("OneStreamExcelAddIn").Object 'OneStream Web URL url = "url" 'okta user credentials oktaUsername = "enter okta username" oktaPassword = "enter okta password" ' app name app = "enter application name" ' get SSO Token ssoToken = xfAddin.ProcessSSOAuthenticationAndCreateToken(url, oktaUsername, oktaPassword) ' display token, only use for validating, if no token exists then login will not be successful MsgBox ssoToken ' Get user from SSO token user = xfAddin.GetXFUserNameFromSSOToken(ssoToken) ' log into application using token isLoggedIn = xfAddin.LogonAndOpenApplication(url, user, ssoToken, app) If isLoggedIn Then MsgBox ("Logged into OneStream") Refresh = xfAddin.RefreshQuickViewsForActiveWorksheet() xfAddin.Logoff Else MsgBox ("Problem with login") End If