BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
crack3n-collab
Obsidian | Level 7

Using jupyter notebook and I am trying to connect to a SAS Viya environment.

The code goes like 

s = CAS(host='sas-cas-server-default-client', port=5570, username='', password='').

I have looked for the host under the sas environment manager as for the username and password is it the exact same as the one I use to log in

onto sas viya?

1 ACCEPTED SOLUTION

Accepted Solutions
gwootton
SAS Super FREQ
You may wish to engage with SAS Technical Support to review the authentication failure from the CAS side.
--
Greg Wootton | Principal Systems Technical Support Engineer

View solution in original post

5 REPLIES 5
gwootton
SAS Super FREQ
Do you log in to Viya with a user name and password in SAS Logon, or through an SSO provider like Okta or Microsoft Entra ID? If you're using SSO then SAS Logon would not be able to validate your user ID and password.

I might go the front end and get an authorization code:
https://viya.example.com/SASLogon/oauth/authorize?client_id=SWAT&response_type=code

Then authenticate by providing that code in your call (note the authorization code is only valid for a few minutes):

s=CAS(host='https://sas-cas-server-default-client:8777' authcode='authcode_from_above')

Alternatively you could get an oauth token directly and provide that, with SSO this would also require an authorization code.

SWAT Authentication
https://sassoftware.github.io/python-swat/getting-started.html?highlight=authentication#oauth-token

Authentication to SAS Viya: a couple of approaches
https://blogs.sas.com/content/sgf/2023/02/07/authentication-to-sas-viya/
--
Greg Wootton | Principal Systems Technical Support Engineer
crack3n-collab
Obsidian | Level 7

I log in to Viya with a username and password. I have given what you said a try but it returns:

ERROR: Connection failed. Server returned: OAuth authentication failed: Access denied.

 

gwootton
SAS Super FREQ
Are you able to connect to CAS from SAS Studio?
--
Greg Wootton | Principal Systems Technical Support Engineer
crack3n-collab
Obsidian | Level 7

Yeah I am able to connect to CAS from SAS studio

gwootton
SAS Super FREQ
You may wish to engage with SAS Technical Support to review the authentication failure from the CAS side.
--
Greg Wootton | Principal Systems Technical Support Engineer