Пікірлер
@pranaydevarashetty1924
@pranaydevarashetty1924 2 ай бұрын
Does this include certficate based authentication ?
@maxirojo7829
@maxirojo7829 2 ай бұрын
Hello! thanks for the video, do you know how to do it with yammer? I get a 401, I can't authenticate
@edzaxon
@edzaxon 2 ай бұрын
Tk u so much, works fine to me, i was hiting with secrets and nothing worked, using certificate the sun rises again
@matiasbertona1811
@matiasbertona1811 2 ай бұрын
TE AMO CAPO CAPISIMOOOOOO
@pranaydevarashetty1924
@pranaydevarashetty1924 2 ай бұрын
Is there a name for the certificate? Since we need to request it, it will be helpful in our organization.
@sairam7363
@sairam7363 3 ай бұрын
Can you also please show us how we can read/write excel files please?
@jinoosvictory6464
@jinoosvictory6464 3 ай бұрын
What if that PC gets hacked and a hacker has access to the variables, having the variables can help to retrieve that user/pass?
@doug8487
@doug8487 Ай бұрын
That is only one of your many possible issues
@wimvangeyt3866
@wimvangeyt3866 4 ай бұрын
Hi great and clear video. I have an error though. at the "access_token" in the if where access token in result. It states the error can not itterate over None type. This is maybe because the account =None?
@marcelolastra4977
@marcelolastra4977 4 ай бұрын
Hi thanks for your video. Do you know if its possible to send a chat message through this way? i mean using the API
@pythonbites2244
@pythonbites2244 4 ай бұрын
Yes, you can. There is API end-point for that: learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http
@jessicaestefaniamartinezbu9098
@jessicaestefaniamartinezbu9098 6 ай бұрын
401 { "error_description": "Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown." }
@pythonbites2244
@pythonbites2244 6 ай бұрын
It looks like you have provided incorrect secrets (client id and client secret).
@utuberay007
@utuberay007 6 ай бұрын
Thanks
@oscargutierrez-by9xy
@oscargutierrez-by9xy 6 ай бұрын
Thanks for the help! Great vid!
@mantiksalcpp
@mantiksalcpp 7 ай бұрын
how to create service principle why you didn't mention ? it is the most important part
@pythonbites2244
@pythonbites2244 7 ай бұрын
Hi There, You can find instructions on that here: learn.microsoft.com/en-us/entra/identity-platform/howto-create-service-principal-portal
@betallyoungattractive644
@betallyoungattractive644 7 ай бұрын
Great video. Very helpful for us
@judeLondon
@judeLondon 7 ай бұрын
Handy stuff. Is there a variation of the method that involves logging into Azure rather using a client in the your python environment than the API details stored as plain text (even if hived up in Windows Env variables), please oh buddy oh pal ?
@pythonbites2244
@pythonbites2244 7 ай бұрын
Hi Jude, sorry for late reply. Variables that I mention (TENTANT_ID, CLIENT_ID, and CLIENT_SECRET) can be fed from any source. It could be a text file with a config (JSON, CSV, YAML or whatever). It does not matter. However, the most secure way in Azure world, would be to have "Identity" assigned to a resource in Azure, and then obtaining that Identity. That Identity should have access to Key Vault. If you want to run your code "outside" of Azure, I think that this is the way to go forward. Assigning and Obtaining identity in Azure is pretty advanced topic, so I haven't covered it here.
@judeLondon
@judeLondon 6 ай бұрын
Many thanks for the informative response. I'm asking as a way to build my knowledge and I guess using api secrets is handy for getting round lack of Entra/AD/m365 authentication. unlike my use case in Synapse notebooks where you have both a logged in Entra user and access to a Synapse linked service to the KV (with a managed account) that I now am using to retrieve key vault secrets
@ArunKonkati
@ArunKonkati 8 ай бұрын
ImportError: cannot import name 'config' from 'config' (/usr/local/lib/python3.8/dist-packages/config/__init__.py) - can you please help me why Im i getting this?
@ammadkhan4687
@ammadkhan4687 8 ай бұрын
Very nice thank you. I have come across Microsft Graph SDK for python called ms graph. With that Library I do not have to get access token. Only problem I am facing is to move email messages to another folder. I will really appreciate if you could make a video on that. Thanks in advance
@pythonbites2244
@pythonbites2244 6 ай бұрын
I think you still need CLIENT_ID and CLIENT_SECRET if you don't have managed identity. I have found here: github.com/microsoftgraph/msgraph-sdk-python <- point 2.3 of the documentation states: # Example using async credentials and application access. from azure.identity.aio import ClientSecretCredential from msgraph import GraphServiceClient credentials = ClientSecretCredential( 'TENANT_ID', 'CLIENT_ID', 'CLIENT_SECRET', ) scopes = ['graph.microsoft.com/.default'] client = GraphServiceClient(credentials=credentials, scopes=scopes)
@yanskee
@yanskee 9 ай бұрын
Thank you!!
@studyenglishvancouver1830
@studyenglishvancouver1830 9 ай бұрын
It is given me the token but i am getting this error, why ? : TZhLTg1ZWMtODUwZjA5NTdjYTZiIiwidXRpIjoiUkFpT2UwanQwMEtEQnZ5eG1CUUVBQSIsInZlciI6IjEuMCIsIndpZHMiOlsiMDk5N2ExZDAtMGQxZC00YWNiLWI0MDgtZDVjYTczMTIxZTkwIl0sInhtc190Y2R0IjoxMzc4NzM5NDQxfQ.Agu56vw1T-P_Eeo7SsvPOewWBFBxhfRy5gLJ7nXuiy8rh6c0xeGRulCmEju-IkdOpfwNthei_2I5ZAJfNkra9y5fT-c3jU6_qktRCvRJe25srPrJ31E0Sd3TVDCnuHvovqDPOQ1TCRMwlWl3vannb4V9WvDbjE6F1cVEaIC5Lg-yhpa8ckXmDInzbmfoh-rgy3TI6PqtL-mIO1e4Ub_5JgDA_l3ejlcsUi-DK80CmJKeQqxjcGBnm3dp0Mt5MgcxaI0kwLSHYnF3K7T1ehIksFEDrTSpHjPsF4G2kOpLRbrNPGMdmifwgu_PkAmmgdrlkvN8bw0leRVLT4DDBTVLJQ { "error": { "code": "Authorization_RequestDenied", "message": "Insufficient privileges to complete the operation.", "innerError": { "date": "2024-02-27T20:45:56", "request-id": "62021559-956a-4d5d-9860-8c6b496ca602", "client-request-id": "62021559-956a-4d5d-9860-8c6b496ca602" } } }
@boomikauba5232
@boomikauba5232 10 ай бұрын
Could you please give us the link to how to upload files to document library using client id client secret ??
@pythonbites2244
@pythonbites2244 6 ай бұрын
Hi Guys, documentation on "uploading" files can be found here: learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http
@emmanuelac6
@emmanuelac6 10 ай бұрын
Thanks a lot for your help, your video saved me a lot of time!! If you mind, could you help me whit what API Permissions should I have to have access to Ms Planner projects? I'm working on a project using python to download that data to a Dataframe, apply some ETL and upload it to a different Database. Thanks!!
@pythonbites2244
@pythonbites2244 10 ай бұрын
Once you are logged in there should be no problem in getting Microsoft Planner plans using Graph API. Keep in mind that in order to keep data in sync with your DB, you need some "sync" mechanism to be developed on your side. I don't see any "delta" on Plans nor Tasks. So it looks like a regular "pull" on data.
@eduardoalmeida4692
@eduardoalmeida4692 10 ай бұрын
Hello great video. But I got this error, Do you Know how to fix it? raise Exception("No Access Token Found") Exception: No Access Token Found
@betallyoungattractive644
@betallyoungattractive644 7 ай бұрын
did you solve it?
@eduardoalmeida4692
@eduardoalmeida4692 7 ай бұрын
@@betallyoungattractive644 No, I gave up
@adamcodes716
@adamcodes716 4 ай бұрын
Put print statements around every "result" or "response" variable. Your issue is most likely with a bad client id or secret
@cosmomind3373
@cosmomind3373 10 ай бұрын
you earned a subscriber pal ! what a simplified video
@kiruthikanagarajan8439
@kiruthikanagarajan8439 11 ай бұрын
Hi. May i know where we need to run the certification command and get the certification done? Thank You!
@lakme4604
@lakme4604 Жыл бұрын
this didn't helped me
@adamcodes716
@adamcodes716 4 ай бұрын
Good to know. Please let everyone know what other videos that didn't help you on youtube. We are all very, very curious
@93RCOral
@93RCOral Жыл бұрын
Hey thanks so much !!!
@itamarmenezesdasilva6779
@itamarmenezesdasilva6779 Жыл бұрын
Thanks for helping us
@Cordycep1
@Cordycep1 Жыл бұрын
Hello: I did not see a prompting of login credential: user name & password when access the sharepoint? Would that be the public key? Did you store that info somewhere so it bypass the login? thanks
@aravindm681
@aravindm681 Жыл бұрын
Sir how important is this. Thank you i m doing this with my project. Thank you so much.
@zxcasdqwe-gc3xz
@zxcasdqwe-gc3xz Жыл бұрын
Hi, don't you need set up the api permission?
@markoradonjic5535
@markoradonjic5535 Жыл бұрын
Thank you very much for this video. This is the most concise and concrete example of how to use MSAL with Python I've managed to find so far! Keep up the good work. Cheers
@jayjhaveri1906
@jayjhaveri1906 Жыл бұрын
Love you man, thanks! I think you are the only one that shows app only access for msal library haha. --- I was using msgraph sdk the new one, but that doesn't work with splunk's inbuilt python. Atleast I wasn't able to make it work. Hopefully msal should work! Have a nice life! :)
@pythonbites2244
@pythonbites2244 Жыл бұрын
Glad I could help!
@rajeshmyakala3148
@rajeshmyakala3148 Жыл бұрын
Hi, is this approach will work where there is no outlook application.?
@pythonbites2244
@pythonbites2244 Жыл бұрын
Yes. Microsoft Graph is a fully backend API.
@vladyslavstadnyk2762
@vladyslavstadnyk2762 Жыл бұрын
I keep getting Unauthorized error when I make requests.get(url=sharepoint_url, headers=headers). What could be possibly wrong? Any settings for the SharePoint app itself? ('{"error_description":"ID3035: The request was not valid or is malformed."}') What more interesting, using sharepoint_url in browser gives correct result in xml Also, "acquire_token_for_client" doesn't have scopes in returned dict.
@MatheusBrito-si6fr
@MatheusBrito-si6fr 5 ай бұрын
same error here. Do you find way to fix it ?
@christianaxel7486
@christianaxel7486 4 ай бұрын
same error, any solution found?
@mennatullahabdallah5819
@mennatullahabdallah5819 Жыл бұрын
Hello, thanks for the video. If i have 2 different sharepoints accounts and i want to access both, should i need 2 certificates? Also is there any other way to authenticate otherthan msal like can i use NTLM Authentication?
@prashanth4899
@prashanth4899 Жыл бұрын
Awesome explanation. Is there a possible way to avoid storing the tenant ID, Client ID, client secret in environment variable and retrieve them using key vault itself by storing these values in the key vault
@pythonbites2244
@pythonbites2244 7 ай бұрын
Well, you need authenticate with KeyVault somehow. If you have a resource "inside" Azure, that is possible. If you run your code outside of Azure environment, you need to provide some sort of credentials.
@AmadoRodrigoRodriguezHeras
@AmadoRodrigoRodriguezHeras Жыл бұрын
Has the class changed or something like that? When executing the code, it shows the error: KeyError: 'x-requestdigest'
@eziola
@eziola Жыл бұрын
I see a "_sc.set_secret()" method. Does that work to write the new keys (e.g. OAuth2) back to Azure?
@pythonbites2244
@pythonbites2244 Жыл бұрын
Yep. You should be able to set Secrets with SecretsClient as well.
@shashikumartheenathayapara2985
@shashikumartheenathayapara2985 Жыл бұрын
Thank you!
@harrykurniansyah3067
@harrykurniansyah3067 Жыл бұрын
Cool video! But can we change the target to personal SharePoint? not Site's SharePoint?
@pythonbites2244
@pythonbites2244 Жыл бұрын
I don't think it matters. It should work for both "personal" and "site" SharePoint. It works for personal SharePoint sites on my end.
@harrykurniansyah3067
@harrykurniansyah3067 Жыл бұрын
@@pythonbites2244 yeah u're right! I just missed to arrange the right url for my personal SharePoint's url also need to adjust the value in scopes_sharepoint_online variable. Great work and videos! Thank you so much from Indonesia.
@AryanSharma-nl7ed
@AryanSharma-nl7ed 11 ай бұрын
​@@pythonbites2244 how i can upload file and update data on sharepoint online plz make video on that also
@lahirusandaruwan6124
@lahirusandaruwan6124 Жыл бұрын
can we use OpenSSL in the production environment?
@pythonbites2244
@pythonbites2244 Жыл бұрын
Yes, you can. Make sure you use a recent version of OpenSSL. OpenSSL is very popular and widely used in production across IT solutions on the planet.
@lahirusandaruwan6124
@lahirusandaruwan6124 Жыл бұрын
@@pythonbites2244 Thank you.. ❤️
@realshmoothie
@realshmoothie Жыл бұрын
Great tutorial. Thank you for your help as the microsoft docs are not great on this
@pythonbites2244
@pythonbites2244 Жыл бұрын
I'm glad it helped out. :D
@flapa2010
@flapa2010 Жыл бұрын
I have searched all internet for this...thanks a million python byte
@pythonbites2244
@pythonbites2244 Жыл бұрын
Happy to help Nelson! :)
@piotrek-ln2uz
@piotrek-ln2uz Жыл бұрын
Thank you for adding this video. I tried your code, but there is an error related to line: „Authorization”: f”Bearer {access_token}”, NameError: name ’access_token’ is not defined … I have also added code: try: access_token = results[„access_token”] except KeyError: print(„failed to obtained access token”) access_token = None and the new error is 401 { „error_description”: „Unsuported security token.” } Do you have any ideas what could have gone wrong?
@DmitrySazhnev-x3z
@DmitrySazhnev-x3z Жыл бұрын
I can't hear anything
@pythonbites2244
@pythonbites2244 Жыл бұрын
It must be something on your end. Video has sound for sure. I have check it even now.
@rodolfo7038
@rodolfo7038 Жыл бұрын
Excellent example. But following the steps you indicate throws the error -> '{"error_description":"ID3035: The request was not valid or is malformed."}' Could you have any suggestions to resolve this error? Thx
@pythonbites2244
@pythonbites2244 Жыл бұрын
Hi Rodolfo, Thank you for your comment and I'm glad to hear that you found the video helpful. Regarding the error you encountered, the message you provided suggests that the request made to SharePoint is invalid or malformed. "ID3035" indicates issue with authorization. I assume that you are able to receive auth token from msal. This error would indicate that token used is obtained using "secret" and not "certificate" for your application client_id. Are you sure you are using certificate? Without more details it would be hard to help you out. Some high level steps that can be taken: 1) Double-check that you have correctly entered all the required parameters, such as the client ID, tenant ID, and SharePoint site URL. 2) Make sure you are using "Certificate" with private key and correct thumbprint. 3) Make sure that the token acquisition process is working correctly, and that you are able to obtain an access token for the SharePoint API. 4) Check if there are any typos or syntax errors in your code that could be causing the issue. 5) Verify that the authentication and authorization configuration in SharePoint is correctly set up. If you're interested we can set some time together (www.patreon.com/pythonbites). Cheers,
@alexvawter1631
@alexvawter1631 Жыл бұрын
hi rodolfo - im having the same issue. have you found a resolution?
@rodolfo7038
@rodolfo7038 Жыл бұрын
@@alexvawter1631 No :-(
@bn_ln
@bn_ln Жыл бұрын
@@rodolfo7038 This may be due to missing API permissions. The code in the video did work for me after setting permissions for Application Sharepoint Sites.FullControl.All (and this will need admin consent granted as well)
@realshmoothie
@realshmoothie Жыл бұрын
Thank you for this reply. This was the issue. Thank you@@bn_ln
@k0.9486
@k0.9486 Жыл бұрын
Why are you using the "acquire_token_silent method"? You don't have token cache set up in this file, you could remove all of that and simply use "acquire_token_for_client", and eliminate everything else pertaining to that token - without the cache it's pointless. Am I missing something?
@pythonbites2244
@pythonbites2244 Жыл бұрын
You are right. It's just a habit I have to do it like that. In this case, it's not needed. Overall I would recommend having cache it in your code as per: msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache.
@ramakrishnaalavala5280
@ramakrishnaalavala5280 Жыл бұрын
Hi How i can connect with sharepoint to read the files. if possible can you do the video on sharepoint access.
@pythonbites2244
@pythonbites2244 Жыл бұрын
Hi there. Great Idea. I will record such video shortly. High level instructions are below. Using Microsoft Graph API do the following 1) Get Site ID using: "/sites/{site_url}" endpoint (learn.microsoft.com/en-us/graph/api/site-get?view=graph-rest-1.0&tabs=http). You need Site ID to get it's documentLibraries. 2) Get Site Drives (documentLibraries) using "/sites/{siteId}/drives" (learn.microsoft.com/en-us/graph/api/drive-list?view=graph-rest-1.0&tabs=http) 3) Download DriveItem (File) using "/drives/{drive-id}/root:/{item-path}:/content" (learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http)
@TheNotoriousFonzy
@TheNotoriousFonzy Жыл бұрын
THIS HELPED ME SO MUCH. THANK YOU!!! BETTER THAN MICROSOFT DOCUMENTATION FOR SURE
@pythonbites2244
@pythonbites2244 Жыл бұрын
Glad it helped!
@ravivenkatatejamucharla1802
@ravivenkatatejamucharla1802 2 жыл бұрын
Hi, can u pls let us know how to do this with client id and secret key
@pythonbites2244
@pythonbites2244 Жыл бұрын
I have recorded another video how to connect to Microsoft Graph using python msal library. You can try it from there, but the API calls will be different.