0

I'm currently working on a project using the OKTA platform and API but have some queries.

  1. When making a GET call for List Apps Assigned to User or List Apps Assigned to User, I'm getting a response for all apps added to the OKTA instance, rather than the ones relevant to the current users session. Is there a flag I'm overlooking?

  2. When getting the result array for list of applications, it returns all the office 365 'sub-apps' (mail, calendar etc) as child arrays to the parent application. However, these sub-apps in the child arrays don't get returned with image links, which other standard applications do. Now while I could hard code for them, it's not ideal. Any advice on this as well?

Thanks!

James-R10
  • 25
  • 5
  • 1: Can you include an example of the GET request you are making to List Applications Assigned to User? http://developer.okta.com/docs/api/resources/apps.html#list-applications-assigned-to-user 2: Can you also include sanitized examples of a request and result that you are getting? – Joël Franusic Dec 01 '16 at 00:14
  • 1. {{url}}/api/v1/apps?filter=user.id+eq+"{{userId}}" 2.https://jsfiddle.net/#&togetherjs=zLIyUg25um – James-R10 Dec 05 '16 at 09:06

1 Answers1

0

There are two ways that you can use list apps assigned to user. First is a server side call that would require an API token with the correct privileges. Second is a browser call once the user has active session with Okta. You would need username in order to make the second call.

  1. GET /api/v1/apps?filter=user.id+eq+"{{userId}}" -> From server-side

  2. GET /api/v1/users/{{username}}/appLinks -> From the browser/JavaScript

To test the second call, paste the URL into a browser with a logged-in session to make sure you get the desired result. You will need to send withCredentials: true in xhrFields if making an AJAX call. For example:

$.ajax({
  type: "GET",
  url: "https://example.okta.com/api/v1/users/{{username}}/appLink",
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  xhrFields: {
    withCredentials: true
  },
  cache: false,
  success: function(data, status)
  {

  },

  error: function(data, status)
  {

  }
});

Both calls would return apps assigned to user.

Joël Franusic
  • 1,178
  • 8
  • 18
Sohaib Ajmal
  • 261
  • 1
  • 4
  • The server side call you have posted is what i'm using but seems to be returning all apps still not just assigned ones. – James-R10 Dec 06 '16 at 00:40
  • James - I just tried the apps call with the userid filter, and that only pulled the user's apps for me. Can you verify that you're making the correct request? For example, if you pass in a bad userId, you should get no apps returned. By the way, an easy way to test this is to use the Apps postman collection (more info [here](http://developer.okta.com/docs/api/getting_started/api_test_client.html)). – remanc Dec 20 '16 at 23:03