Coder Social home page Coder Social logo

Comments (5)

hongooi73 avatar hongooi73 commented on August 24, 2024

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.

hongooi73 avatar hongooi73 commented on August 24, 2024

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.

anapaularg avatar anapaularg commented on August 24, 2024

Ok, so I need the "Files.Read" permissions and I can see that I don't have them:

image

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)
image

Also I add this so I could use resource_owner

image

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")
`
image

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.

hongooi73 avatar hongooi73 commented on August 24, 2024

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.

hongooi73 avatar hongooi73 commented on August 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.