## 5.1 Configure User Authentication
Configure user authentication and access the document grounding capability.
To access the document grounding capability, complete the following configuration steps:
1. Open the SAP BTP cockpit and go to the subaccount where you've subscribed to Joule.
2. Navigate to Services Service Marketplace .
3. Search for document grounding and choose the tile.
4. Choose Create .
5. Choose Other as Runtime Environment . Enter an Instance Name , copy it, and paste it into a text editor. You need the instance name in step 12. Choose Create .
6. Choose View Instance .
7. Select the instance and create a service binding. Enter a Service Binding Name .
8. Choose Create . Once the service binding is created, choose its name to display the details. Copy the service binding URL and paste it into a text editor. You need this URL in step 21.
9. Again, navigate to Services Service Marketplace .
10. Search for Cloud Identity Services and choose the tile.
11. Choose Create . Choose application as Plan and Other as Runtime Environment . Enter an Instance Name . Choose Next .
12. In Parameters , enter the following parameter, using the Instance Name that you created for document grounding in step 5 as the "service-instance-name" value:
13. Choose Create .
14. Choose View Instance .
```
{ "consumed-services":[ { "service-instance-name":"<doc-grounding-instance-name>" } ] }
```
15. Select the instance and create a service binding. Enter a Service Binding Name and the following parameters:
```
"credential-type": "X509_GENERATED",
```
```
{ "validity": 365, "validity-type": "DAYS" }
```
##  Remember
SAP Cloud Identity Services triggers an automatic e-mail when the certificate is nearing its expiration date. To generate the new certificate, re-create the service binding.
16. Choose Create .
17. Once the service binding is created, choose its name to display the details.
18. Copy the values for "clientid" and "authorization\_endpoint" from the service binding and paste them into a text editor.
##  Note
Edit the "authorization\_endpoint" value by replacing the ending .../oauth2/authorize with .../oauth2/ token.
You need the values for "clientid" and "authorization\_endpoint" in step 20.
19. Create two files (for example, doc-grounding.crt and doc-grounding.key ) using the service binding values for "certificate" and "key". The files can have any name.
##  Note
The service binding values are generated with the characters "\n" representing new lines, instead of actual line breaks. To use the doc-grounding.crt and doc-grounding.key files, convert the "\n" characters into real line breaks. You can do so either manually, replacing each "\n" with a line break, or using a bash function, as in the following examples:
## For MacOS:
```
sed 's/\\n/\n/g' doc-grounding.crt > temp.crt && mv temp.crt docgrounding.crt sed 's/\\n/\n/g' doc-grounding.key > temp.key && mv temp.key docgrounding.key For Windows PowerShell: (Get-Content -Path doc-grounding.crt -Raw) -replace '\\n', "`n" | Set-Content -Path temp.crt; Move-Item -Path temp.crt -Destination docgrounding.crt -Force (Get-Content -Path doc-grounding.key -Raw) -replace '\\n', "`n" | Set-Content -Path temp.key; Move-Item -Path temp.key -Destination docgrounding.key -Force
```
- 20.To get a token, submit the following request in the same folder you downloaded the doc-grounding.crt and doc-grounding.key files:
```
curl \ --request POST \ --url <edited_authorization_endpoint> \ --header 'accept: application/json' \ --header 'content-type: application/x-www-form-urlencoded' \ --data 'client_id=<clientid>' \ --data 'grant_type=client_credentials' \ --cert <file_with_certificate> \ --key <file_with_key>
```
## Placeholder
## Description
| <edited_authorization_endpoint>   | The "authorization_endpoint" value that you obtained in step 18, edited as described in step 18   |
|-----------------------------------|---------------------------------------------------------------------------------------------------|
| <clientid>                        | The "clientid" value that you obtained in step 18                                                 |
| <file_with_certificate>           | The doc-grounding.crt file, edited with line breaks as described in step 19                       |
| <file_with_key>                   | The doc-grounding.key file, edited with line breaks as described in step 19                       |
You should receive a response like the following:
```
{ "access_token":"eyJq........LI-L8KsOQV593dmtPU1g", "token_type":"Bearer", "expires_in":3600 }
```
##  Note
You need the token to Set Up Content Ingestion [page 114].
21. Use the service binding URL, the token, and the doc-grounding.crt and doc-grounding.key files to call the document grounding endpoints:
```
curl \ --request GET \ --url '<url>/pipeline/api/v1/pipeline' \ --header 'accept: application/json' \ --header 'Authorization: Bearer <access_token>' \ --cert <file_with_certificate> \ --key <file_with_key>
```
## Placeholder
## Description
| <url>                   | The service binding URL value for document grounding that you obtained in step 8   |
|-------------------------|------------------------------------------------------------------------------------|
| <file_with_certificate> | The doc-grounding.crt file, edited with line breaks as described in step 19        |
| Placeholder     | Description                                                                 |
|-----------------|-----------------------------------------------------------------------------|
| <file_with_key> | The doc-grounding.key file, edited with line breaks as described in step 19 |
You should receive a response with an empty list [] since the pipeline hasn't been created yet.