Skip to content

Commit

Permalink
Merge pull request #25 from swimlane/3_1_0_release
Browse files Browse the repository at this point in the history
3.1.0 release
  • Loading branch information
MSAdministrator authored Oct 8, 2021
2 parents 7cbc384 + fe13185 commit 61cc602
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyews/core/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def oauth2_authorization_type(cls):

@oauth2_authorization_type.setter
def oauth2_authorization_type(cls, value):
if value in ['legacy_app_flow', 'auth_code_grant', 'client_credentials_grant', 'backend_app_flow', 'web_application_flow', 'implicit_grant_flow']:
if value in ['interactive_auth_code_grant', 'legacy_app_flow', 'auth_code_grant', 'client_credentials_grant', 'backend_app_flow', 'web_application_flow', 'implicit_grant_flow']:
cls._oauth2_authorization_type = value
cls.__set_initial_property_values()

Expand Down
23 changes: 23 additions & 0 deletions pyews/core/oauth2connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,29 @@ def __build_query_param_url(self, url, params):
url_parse = url_parse._replace(query=url_new_query)
return urlunparse(url_parse)

def interactive_auth_code_grant(self):
oauth = OAuth2Session(
client_id=self.client_id,
redirect_uri=self.redirect_uri,
scope=self.scope
)
authorization_url, state = oauth.authorization_url(
self.authorize_url,
)
auth_code = self.__prompt_user(authorization_url)
response = self.session.request(
'POST',
self.token_url,
data={
"client_id": self.client_id,
"code": auth_code,
"grant_type": "authorization_code",
"redirect_uri": self.redirect_uri,
"client_secret": self.client_secret
}
)
return response.json()

def auth_code_grant(self):
"""Authorization Code Flow Grant
Reference: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def parse_requirements(requirement_file):

setup(
name='py-ews',
version='3.0.0',
version='3.1.0',
packages=find_packages(exclude=['tests*']),
license='MIT',
description='A Python package to interact with both on-premises and Office 365 Exchange Web Services',
Expand Down

0 comments on commit 61cc602

Please sign in to comment.