3
votes

Scope

I am trying to put together a simple Python CLI script that will consume the Office 365 Service Communications API reference (preview) in order to retrieve the current status for various workloads.

In order to use the API I've registered and configured a new application in Azure AD with the necessary permissions which will use the OAuth2.0 Code Grant Flow.

Question

How do I programmatically bypass the Sign in step required in order to get the authorization code?

In code am doing a GET on the following URL:

https://login.microsoftonline.com/{tenant_identifier}/oauth2/authorize?client_id=my_client_id&redirect_uri=my_redirect_uri&resource=my_resource&response_type=code

If this is not the correct flow please correct me, wondering if I need to require the authorization code first as a parameter to run this script!

Thanks in advance.

1

1 Answers

3
votes

Instead of using the Authorization Code Grant Flow which requires the user's consent in order acquire the authorization code, as this is more suited for native client applications and websites, I should of used the Service to Service Calls Using Client Credentials which uses the application's own credentials to authenticate and acquire the access token from Azure AD.

The Client Credentials Grant Flow is more suited for web services and daemons which is what am building.