I understand how to access the Sharepoint REST API using interactive authentication, i.e. having a user at the computer type a username/password into a webapp. Is there a way to let a commandline app access the API? e.g. connect and query a Sharepoint list without user intervention?
I've registered a native client in the tenant and have an AppId (no app secret) but all API calls return 401 Unauthorized
. I've also tried accessing via the Graph API but get 403 Forbidden
. These are both using the access_token from the initial client_credentials flow of a tenant registered web app, which I would expected to have worked.
It doesn't appear to be possible to get an access_token using only an AppId as the flow requires a client secret.
This says:
This type of permission requires administrator consent and is also not available for native client applications
which doesn't appear to make sense as it requires administrator permissions for something that can't be done. If native clients can't access APIs it's not clear what they're for. Perhaps the above refers to web apps rather than native clients, i.e. an Admin can allow a web app to connect using an access_token without a user context.