Comments (5)
AzureGraph uses the beta API by default, not 1.0; this is because only the beta lets you work with apps and service principals. See if changing the API fixes it:
call_graph_endpoint(token, operation, api_version="v1.0")
from azuregraph.
Ok, it's not due to the endpoint. It's probably because the default token scope doesn't include the necessary permissions to access OneDrive. You can check this with
AzureAuth::decode_jwt(login$token)$payload
and see if the $scp
field includes anything like "Files.Read" or "Files.ReadWrite".
To get around this you'll have to register your own app and give it the necessary permissions; the default app used by AzureGraph is meant for working with Azure, not Office so won't have the permissions required.
Once you've created the app, use it to authenticate:
scopes <- paste0("https://graph.microsoft.com/",
c("User.Read", "Files.Read.All"))
tok <- AzureAuth::get_azure_token(c(scopes, "offline_access"), "yourtenant", "yourappid",
version=2)
call_graph_endpoint(tok, "me/drive/root/children")
from azuregraph.
Ok, so I need the "Files.Read" permissions and I can see that I don't have them:
Then I went to the Azure Portal, registered and app and add this permissions (it's private cloud and I 'm not an admin but the permission here says that I don't need admin permissions)
Also I add this so I could use resource_owner
However, I get the following error:
`scopes <- paste0("https://graph.microsoft.com/",c("User.Read", "Files.Read"))
tok <- AzureAuth::get_azure_token(resource = c(scopes,"offline_access"),
tenant = "3e0289c2-e351-4c79-998b-8167c83a06d3",
app = "2da13551-b7e2-4ad5-8430-87d52b2b60c6",
version=2,
auth_type = "resource_owner",
username = "<my_email>",
password = "<my_password>")
call_graph_endpoint(tok, "me/drive/root/children")
`
What's is the configuration or auth_type required so I can get this running? Also this will be a an automated process to run every day, the idea is to read files from excel online (excel in one drive).
from azuregraph.
I think you still need to get your admin to approve the permissions. The portal is kinda badly designed.
The alternative is to use the app ID that OneDrive itself uses. I'll see if i can track that down, or you can try asking on StackOverflow.
from azuregraph.
So there is an app that OneDrive uses, but it requires a client secret. I think the only way is to create your own app.
from azuregraph.
Related Issues (19)
- Add app methods
- Read / Download Sharepoint Files HOT 1
- Handle 503 errors HOT 3
- Handle throttling gracefully
- Get user by email address HOT 2
- Don't assume caching dir exists
- Class `ms_graph` - add `select` argument to the `list_users()` method HOT 2
- Unable to pass custom headers to Graph endpoint HOT 1
- Setting item permission problem HOT 3
- Use addPassword to set app passwords HOT 1
- setting permission to something other than {read, write, owner} HOT 2
- This repo is missing important files
- Expose `op` to update custom metadata fields on items
- Access denied when trying to send email HOT 2
- Switch to 1.0 API
- How to list drive items HOT 5
- /me endpoint fails for externally added user HOT 1
- Add SharePoint File Upload HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azuregraph.