You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-js/features/connectivity/destination.mdx
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -275,6 +275,9 @@ Note, that if your `serviceBindingTransformFn()` function does not provide a nam
275
275
276
276
More advanced examples with service token fetching can be found in [service-binding-to-destination.ts](https://github.com/SAP/cloud-sdk-js/blob/main/packages/connectivity/src/scp-cf/destination/service-binding-to-destination.ts).
277
277
278
+
For the `identity` service type, the SAP Cloud SDK also provides the standalone convenience functions `getIasToken()` and `getIasDestination()`, which can also work with bare `ServiceCredentials` outside of a `VCAP_SERVICES` binding.
279
+
See the [Identity Authentication Service](./ias#convenience-functions) documentation for details.
280
+
278
281
If you want to skip the destination lookup and consider only the service bindings, call the [getDestinationFromServiceBinding()](pathname:///api/v4/functions/sap-cloud-sdk_connectivity.getDestinationFromServiceBinding.html) function with the service name and options.
Copy file name to clipboardExpand all lines: docs-js/features/connectivity/ias.mdx
+65-6Lines changed: 65 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,12 +81,16 @@ sequenceDiagram
81
81
82
82
### Creating Destinations
83
83
84
-
Use [`getDestinationFromServiceBinding()`](pathname:///api/v4/functions/sap-cloud-sdk_connectivity.getDestinationFromServiceBinding.html) to connect to a system that is registered as an application within IAS.
84
+
Use [`getDestinationFromServiceBinding()`](pathname:///api/v4/functions/sap-cloud-sdk_connectivity.getDestinationFromServiceBinding.html)or [`transformServiceBindingToDestination()`](pathname:///api/v4/functions/sap-cloud-sdk_connectivity.transformServiceBindingToDestination.html)to connect to a system that is registered as an application within IAS.
85
85
The parameter `iasOptions` contains:
86
86
87
87
-`targetUrl`: The URL of the system where the target application resides.
88
88
-`resource`: The dependency identified by its name or identifier configured in IAS (see [App2App Resources](#app2app-resources)) section.
89
89
90
+
In addition to these standard functions for destination retrieval and transformation, the SAP Cloud SDK provides two convenience functions, [`getIasDestination()`](pathname:///api/v4/functions/sap-cloud-sdk_connectivity.getIasDestination.html) and [`getIasToken()`](pathname:///api/v4/functions/sap-cloud-sdk_connectivity.getIasToken.html), which fetch an IAS token and return a destination or token result respectively.
91
+
These functions are useful when you need direct access to the IAS token or destination, for example outside BTP environments with pre-populated `VCAP_SERVICES` or when constructing a destination manually.
92
+
Refer to the [Convenience Functions](#convenience-functions) section below for more details.
93
+
90
94
#### Technical User Authentication
91
95
92
96
For service-to-service communication with client credentials:
// Token request is automatically routed to the subscriber's IAS tenant
248
247
```
248
+
249
+
## Convenience Functions
250
+
251
+
The SAP Cloud SDK provides two convenience functions for working with IAS tokens directly.
252
+
These are useful when you need access to the IAS token or destination, for example outside BTP environments with pre-populated `VCAP_SERVICES` or when constructing a destination manually.
253
+
254
+
Both functions accept a service as `Service | string | ServiceCredentials`, unlike `getDestinationFromServiceBinding()` they also accept bare `ServiceCredentials` (e.g., just `clientid`, `clientsecret`, and `url`).
255
+
256
+
-**[`getIasDestination()`](pathname:///api/v4/functions/sap-cloud-sdk_connectivity.getIasDestination.html)** fetches an IAS token and builds a ready-to-use [`Destination`](pathname:///api/v4/interfaces/sap-cloud-sdk_connectivity.Destination.html) with the token, the target URL, and the mTLS key pair from the service binding credentials (if present).
257
+
-**[`getIasToken()`](pathname:///api/v4/functions/sap-cloud-sdk_connectivity.getIasToken.html)** fetches an IAS token and returns an [`IasTokenResult`](pathname:///api/v4/interfaces/sap-cloud-sdk_connectivity.IasTokenResult.html) with the access token string, its expiration, and an optional refresh token.
258
+
259
+
:::note
260
+
261
+
`getIasToken()` returns the access token as a raw string rather than a decoded JWT, as IAS tokens may not always be in JWT format.
262
+
263
+
:::
264
+
265
+
:::note
266
+
267
+
The `targetUrl` is ignored if `getIasToken()` is used.
// Use getIasToken() to retrieve an IAS token (business user)
290
+
const token =awaitgetIasToken(
291
+
{
292
+
clientid: 'CLIENT_ID',
293
+
clientsecret: 'CLIENT_SECRET',
294
+
url: 'https://my-ias.accounts.ondemand.com'
295
+
},
296
+
{
297
+
authenticationType: 'OAuth2JWTBearer',
298
+
assertion: JWT_ASSERTION,
299
+
resource: { name: 'backend-api' }
300
+
}
301
+
);
302
+
```
303
+
304
+
The `Destination` returned by `getIasDestination()` can be passed directly to any SAP Cloud SDK request builder or HTTP client.
305
+
306
+
For the full set of options both functions accept the same [`IasTokenOptions`](pathname:///api/v4/types/sap-cloud-sdk_connectivity.IasTokenOptions.html) which includes `iasOptions` properties as available in [`getDestinationFromServiceBinding()`](pathname:///api/v4/functions/sap-cloud-sdk_connectivity.getDestinationFromServiceBinding.html) or [`transformServiceBindingToDestination()`](pathname:///api/v4/functions/sap-cloud-sdk_connectivity.transformServiceBindingToDestination.html).
307
+
See the [App2App Authentication](#app2app-authentication) section above for details.
0 commit comments