+

Search Tips | Advanced Search

For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


JavaScript custom resource-request implementation sample

A JavaScript sample for acquiring data from a protected resource by using the MobileFirst WLAuthorizationManager class.

The sample implements a standard OAuth flow: first, a resource request is sent without an access token. This request is expected to fail with an authorization error. Then, WLAuthorizationManager is used to obtain an access token for the resource's protecting scope, and the request is sent again with the obtained access token as an authorization header. The resource request is created by using a standard XMLHttpRequest object.

Parent topic: Sample custom resource-request implementations using WLAuthorizationManager