Desire2Learn - Cannot retrieve what's passed as the "user_id" value in an LTI post from the Valence API - desire2learn

I was hoping someone could give me some insight into this, basically I was hoping to find a way to either return this value for a given user via the Valence API or calculate this value based on the user's primary key that's passed over in an LTI post.
What is sent in the LTI POST as the user identifier: user_id=815dc366-c443-4023-a13c-9c43e9edce52_239393
What's returned from the Valence API as the user identifier: Enrollment.ClasslistUser.Identifier=228588

The Brightspace application APIs currently don't provide a way to retrieve the LTI user identifier for a user. The LTI user identifier sent in the user_id LTI launch property is currently only available via LTI launches.
Additionally, the LTI user_id values that Brightspace assigns to users are intentionally opaque and not constructable by clients. (It's true that some Brightspace instances send the D2L ID as a component in the LTI launch user_id property, but you should not depend upon that.)

Related

user_image for desire2learn LTI provider

I am creating an LTI tool, but do not see the user_image parameter being passed from Desire2Learn/Brightspace.
How can I retrieve this?
Brightspace does not pass this optional parameter in LTI launches. You can, however, use the Brightspace APIs to retrieve the current, launching user's profile image. (One subtle point there, though: as retrieving a user's profile image requires an (authorized) API call, you can store the API call to retrieve it as a URL, however, you'll need to wrap it with auth tokens when calling it.)
D2L's reference topic on their Remote Plugin service contains an extended example showing how a simple tool provider can use the Brightspace APIs in conjunction with an LTI launch

Is there a unique identifier for a user across different Google APIs?

I am using google's oauth2 to allow users to register/login into my site (php library). The first time a user attempts to login I get the user's email address and google+ id which are provided by the Google OAuth2 API (with the user's permission).
In a different part of the site I need some information from the user's youtube channel. I am using the incremental authorization to get the extra permissions as it is recommended (and described here: https://developers.google.com/identity/protocols/OAuth2WebServer#incrementalAuth ).
The problem is that I don't have a unique identifier for the user between the calls, in order to keep track of him/her in my side of the application. A user, for example might have multiple youtube channels and each one can be associated with a different google+ account/id and a different email address, which most of the time is not a real address but a provided email with the format 'username-XXXX#plus.google.com'.
I was wondering if google's apis can return a unique identifier for the 'parent' account of a user across different apis.
Thanks in advance.

Valence API that replaces the older WS UserManagementService

One of our integrations uses the D2LWS UserManagementService to convert a username to userId. We receive the username, firstname and lastname of the student when they click through an LTI request, but we need the numeric userId for some of the other Valence API calls.
We would like to reduce our dependency on the D2LWS before they are retired, so we are wondering if there is an equivalent Valence API call that can be used to do this conversion?
There are many ways for a client application to fill out its understanding of an LMS user identity's properties. It is also noteworthy to remember that the D2LWS platform is essentially optimized for service-to-service level operational trust, while the newer Valence platform is optimized for user-to-service operational trust -- this means that all Valence calls must happen in the context of some real, authenticated LMS user account (in the sense that in order to make calls, the client application must first request to acquire a user ID/Key pair for an authenticated user).
If your client service will always be contacted or prompted by the LMS with an LTI launch, then you will have enough capacity from that launch to begin (please see this detailed topic on combining Valence calls with LTI around our Remote Plugin service). There should be a real LMS user that would have initiated that launch somehow, from a logged-in LMS session. Therefore, after the LTI launch, your service can turn right around and make a call to the LMS to request user tokens for the currently auth'd user and this user should almost certainly be the LTI-launching user.
Typically, for services that get contacted from an LTI launch and then want to use Valence, we recommend that you establish a user context immediately after the launch and make a whoami call: this can serve multiple purposes -- it can establish that you have a dependable set of user tokens you can use to make Valence calls on behalf of the launching user, and you can use the information retrieved in the WhoAmIUser data structure to assist in filling out the context of your user identity.
For your particular purposes, the WhoAmIUser data structure contains the first name, last name, unique name (user name), and LMS profile identifier for the launching user, as well as the LMS user identifier (Identifier) property that you can use in the context of other Valence calls should you need to. However, you should also strongly consider a shift to the user-to-service approach: when all the calls take place within the context of a particular user, you may discover that your best route is employing all the "my" routes to fill out the user experience you present to a user -- keep in mind that the user's credentials you employ with your Valence API calls restrict your access to functionality and data exactly as that user would be restricted in the course of his or her normal interactions with the LMS through its web UI.

Can I get an LMS-specific or org-specific user identifier in a Desire2Learn LE LTI launch?

By default, an LTI launch sent from the D2L LE provides the user_id property to uniquely identify the user making the LTI launch; however, this user ID can't be directly used with the LMS or most other institution systems to refer to the user: it is specific to LTI launches. Can I configure the LTI launch to provide a way to identify the user that I can directly use with the LMS or with other organization services (such as an LMS user ID, or a user log-in name)?
You can configure an External Learning Tool in the Learning Environment to provide more information with LTI launches: the precise list properties that an external learning tool can include in an LTI launch are first governed by the security settings for the LMS as Tools Consumer Information (in the "Settings" page for the External Learning Tools management screen); assuming that the LMS is configured to let LTI launches provide a wide variety of properties, you can set the launch to include one or more of these bits of information:
Send user ID to tool provider
This sends the LTI user_id property in the LTI launch.
Send user name to tool provider
This sends the user's name information in the properties lis_person_name_given, lis_person_name_family, and lis_person_name_full.
Send user email to tool provider
This sends the user's email information in the lis_person_contact_email_primary property.
Send system username to tool provider
This sends the user's LMS UserName (the name that a user would log into the LMS with) as the ext_d2l_username property.
Send system Org Defined ID to tool provider
This sends the organization's defined identifier for the student in the ext_d2l_orgdefinedid property. This is often the institution's student or employee number for the LMS user.
Send system role to tool provider
This sends the LMS role ID for the launching user within the org unit context from the launch occurred, in the property ext_d2l_role.
If you need to get the LMS UserID value for a user, then you can try using the Valence Learning Framework APIs. Immediately upon LTI launch, make a call to the APIs to retrieve a set of user tokens back to the launching domain; this should fetch you the user tokens for the launching user (who must currently have an current logged-in session with the LMS). You can then use a whomai call to verify that the user is who you think she is (by comparison to the bits of information from the LTI launch), or to fetch that user's LMS UserID property.

Usage Data via Valence API

Is there a way to pull user usage data from the Valence API?
In particular I want to know if a user has ever logged in or accessed a certain course.
No, sorry, currently that information is not available through the Valence APIs. If you'd like the Valence APIs to provide that information, and you're affiliated with a D2L customer, please use their account management chain to report your request. If you're not directly affiliated with a D2L account manager, then you can report your request through the Valence support chain.
This particular request is something that other partners and customers have indicated an interest for.

Resources