-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED] JSONDecodeError with invalid oauth/camunda_cloud credentials (#…
…49)
- Loading branch information
1 parent
c46122d
commit 6adda0e
Showing
8 changed files
with
72 additions
and
17 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
from pyzeebe.credentials.oauth_credentials import OAuthCredentials | ||
from pyzeebe.exceptions import InvalidOAuthCredentials, InvalidCamundaCloudCredentials | ||
|
||
|
||
class CamundaCloudCredentials(OAuthCredentials): | ||
def __init__(self, client_id: str, client_secret: str, cluster_id: str): | ||
super().__init__(url="https://login.cloud.camunda.io/oauth/token", client_id=client_id, | ||
client_secret=client_secret, audience=f"{cluster_id}.zeebe.camunda.io") | ||
try: | ||
super().__init__(url="https://login.cloud.camunda.io/oauth/token", client_id=client_id, | ||
client_secret=client_secret, audience=f"{cluster_id}.zeebe.camunda.io") | ||
except InvalidOAuthCredentials: | ||
raise InvalidCamundaCloudCredentials(client_id=client_id, cluster_id=cluster_id) | ||
|
||
def get_connection_uri(self) -> str: | ||
return f"{self.audience}:443" |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from pyzeebe.exceptions.pyzeebe_exceptions import PyZeebeException | ||
|
||
|
||
class InvalidOAuthCredentials(PyZeebeException): | ||
def __init__(self, url: str, client_id: str, audience: str): | ||
super().__init__( | ||
f"Invalid OAuth credentials supplied for {url} with audience {audience} and client id {client_id}") | ||
|
||
|
||
class InvalidCamundaCloudCredentials(PyZeebeException): | ||
def __init__(self, client_id: str, cluster_id: str): | ||
super().__init__(f"Invalid credentials supplied for cluster {cluster_id} with client {client_id}") |
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
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
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