feat: OAuth 2.0. Allow including client_id in backend app auth request.
As per rfc6749 section-3.2.1, clients: > MAY use the "client_id" request parameter to identify itself when > sending requests to the token endpoint. This patch allows to include client_id in BackendAppFlow, for servers that require it.
This commit is contained in:
parent
17d6d81fb5
commit
cfbbaffd1d
1 changed files with 6 additions and 2 deletions
|
|
@ -148,7 +148,7 @@ class ConnectedApp(Document):
|
|||
|
||||
return token_cache
|
||||
|
||||
def get_backend_app_token(self):
|
||||
def get_backend_app_token(self, include_client_id=None):
|
||||
"""Get an Access Token for the Cloud-Registered Service Principal"""
|
||||
# There is no User assigned to the app, so we give it an empty string,
|
||||
# otherwise it will assign the logged in user.
|
||||
|
|
@ -163,7 +163,11 @@ class ConnectedApp(Document):
|
|||
client = BackendApplicationClient(client_id=self.client_id, scope=self.get_scopes())
|
||||
oauth_session = OAuth2Session(client=client)
|
||||
|
||||
token = oauth_session.fetch_token(self.token_uri, client_secret=self.get_password("client_secret"))
|
||||
token = oauth_session.fetch_token(
|
||||
self.token_uri,
|
||||
client_secret=self.get_password("client_secret"),
|
||||
include_client_id=include_client_id,
|
||||
)
|
||||
|
||||
token_cache.update_data(token)
|
||||
token_cache.save(ignore_permissions=True)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue