Looking at the Python SDK and trying to assign a group to an application but running into one issue.
TypeError: ApplicationClient.create_application_group_assignment() missing 1 required positional argument: 'application_group_assignment'
Not understanding this positional argument as on the API it only has groupid and appid as reference. The source is at okta-sdk-python/application_client.py at c4f948761c26dc48838764dd4e96253b6beead04 · okta/okta-sdk-python · GitHub
Appreciate any insight on this.
warren
March 7, 2023, 5:19pm
3
Can you try with app, resp, err = await client.create_application_group_assignment(appId='{app_id}', groupId='{group_id}', application_group_assignment={})
?
warren:
app, resp, err = await client.create_application_group_assignment(appId=‘{app_id}’, groupId=‘{group_id}’, application_group_assignment={})
that returns None for app and HTTP 403 for err. I can manually do this using api endpoint myself though and it works just not with SDK.
warren
March 7, 2023, 9:19pm
5
Are you substituting {app_id}
and {group_id}
with your application id and group id?
I’m using an Okta API token for my client config and the code is working for me.
If it’s still not working, do you mind sharing your code and omitting sensitive information?
the function is simple.
async def _create_application_group_assignment(appid, groupid):
"""
Args:
appid (str): application id
groupid (str): group id
"""
app, resp, err = await client.create_application_group_assignment(appId=appid, groupId=groupid, application_group_assignment={})
if resp._status == 200:
return app
and I am calling it with result = await _create_application_group_assignment("some_appid", "some_groupid")
.
I know my API KEY works because I have other functions that work as expected just not this one.
Are you able to get application and group details using same app id and group id using curl and GET for api/v1/apps/ ? And similar for api/v1/groups?
I have this function which works.
async def _application_group_assign(appid, groupid):
okta_url = "https://domain.com/"
api_key = "randomkey"
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': f'SSWS {api_key}'
}
async with aiohttp.ClientSession() as session:
async with session.put(okta_url + f'api/v1/apps/{appid}/groups/{groupid}',
headers=headers) as resp:
res = await resp.json()
return res
This works for me but using SDK it does not.
Problem solved it was an issue with wrong credentials
system
Closed
March 11, 2023, 4:17am
10
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.