Hello Philippe,
To download a SharePoint file using the access token obtained from the curl command, you can use the wget
command with the --header
option to include the Authorization header with the token.
Here's an example command using wget
:
bashCopy code
wget --header="Authorization: Bearer [access_token]" "[share_link]"
Replace [access_token]
with the actual access token obtained from the curl command, and [share_link]
with the direct link to the SharePoint file you want to download.
Alternatively, if you want to use the tenant ID, client ID, and client secret directly with wget
, you'll need to use them to acquire an access token first. Here's an example using curl
to obtain the access token and then using wget
to download the file:
bashCopy code
# Get the access token
access_token=$(curl -X POST -d 'grant_type=client_credentials&client_id=[client_id]&client_secret=[client_secret]&resource=https%3A%2F%2Fmanagement.azure.com%2F' https://login.microsoftonline.com/[tenant_id]/oauth2/token | jq -r '.access_token')
# Download the file using wget and the access token
wget --header="Authorization: Bearer $access_token" "[share_link]"
Replace [client_id]
, [client_secret]
, [tenant_id]
, and [share_link]
with the appropriate values for your application and the SharePoint file you want to download.
Note that the second example uses jq
to extract the access token from the response of the curl command. Make sure you have jq
installed on your system or adjust the command accordingly if you prefer to extract the token using other means.