-
-
Save AnishDe12020/eebb22369899e0f41ffebe8beb710337 to your computer and use it in GitHub Desktop.
Issue with the code, gives an error after successful authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from configparser import ConfigParser | |
def config(): | |
config = ConfigParser() | |
config.add_section("graph_api") | |
config.set("graph_api", "client_id", "<CLIENT_ID>") | |
config.set("graph_api", "client_secret", "<CLIENT_SECRET>") | |
config.set("graph_api", "redirect_uri", "https://localhost/graph_login") | |
with open(file="configs/config.ini", mode="w+") as config_file: | |
config.write(config_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from configurator import config | |
from configparser import ConfigParser | |
from ms_graph.client import MicrosoftGraphClient | |
config() | |
config = ConfigParser() | |
config.read("configs/config.ini") | |
scopes = [ | |
"files.read" | |
] | |
creds_file = "configs/ms_graph_state.jsonc" | |
client_id = config.get("graph_api", "client_id") | |
client_secret = config.get("graph_api", "client_secret") | |
redirect_uri = config.get("graph_api", "redirect_uri") | |
graph_client = MicrosoftGraphClient( | |
client_id = client_id, | |
client_secret = client_secret, | |
redirect_uri = redirect_uri, | |
scope = scopes, | |
credentials = creds_file | |
) | |
graph_client.login() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment