-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HttpPost Basic Auth. #107
Comments
It appears that the API does not accept explicit basic auth parameters, but it does accept headers. https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication where the header value is a base64 encoded username/password combo. The functionality to accept a username and password, encode and autoformat could be added onto pymsteams. It's not currently on the roadmap, but I'd be willing to review and merge a pull request. |
Hi,
Maybe we have to add the following to the action dict:
Do you think that will work? |
I think that could work. If it does, please submit!
…On Wed, Sep 22, 2021 at 9:18 AM svenrr ***@***.***> wrote:
Hi,
thanks for the answer!
def addAction(self,_type,_name,_target): if "actions" not in
self.payload.keys(): self.payload["actions"] = [] action = { ***@***.***":
_type, "name": _name, "target": _target }
Maybe we have to add the following to the action dict:
headers = { "Authorization": "Basic {}".format(
b64encode(bytes(f"{user}:{password}", "utf-8")).decode("ascii") )
Do you think that will work?
If yes, I can try to implement this and I'll do a pull request.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#107 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABXLSLPOJSEFYIFGRFUZJFDUDHQTFANCNFSM5D5PWCMQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Hi, The payload seems to work but I got this teams error: it looks like this: Maybe you have an idea? |
Hmmm....seems as if that should work. I'm assuming the button appeared as
you expected, then you saw the error when the button was clicked?
Perhaps the header doesn't work as expected? Is this something you can get
working outside of teams, maybe with curl?
…On Thu, Sep 23, 2021 at 5:30 AM svenrr ***@***.***> wrote:
Hi,
I came up with the following (see addAction):
https://github.com/svenrr/pymsteams/blob/master/pymsteams/__init__.py
The payload seems to work but I got this teams error:
The remote endpoint has returned an error (HTTP Unauthorized). Please try
again later.
it looks like this:
'actions': ***@***.***': 'HttpPost', 'name': 'Claim', 'target': '
www.xxx.com/task/claim', 'headers': [{'name': 'Authorization', 'value':
'Basic Y2FtYWRtaw32ZEV8J28sLkEuLnrVu3diT147JzA='}], 'body': 'userId=admin',
'bodyContentType': 'application/x-www-form-urlencoded'}
Maybe you have an idea?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#107 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABXLSLNOSF2RIJMSSLZIEJ3UDL6TRANCNFSM5D5PWCMQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
yes exactly. I tried to do the same with requests module and there it worked, but there are small differences. You don't put the auth json in an array/list and normally you put the data/variables not in the header... for body I also tried json/dict in a string. |
Hi,
I don't know if it's possible. I could not find anything about this in Microsoft Docs either. It is about "HttpPost".
Is there also the possibility for an authentication there, similar to "requests" with basic auth. via "auth=("user", "pw")?
Thanks in advance!
The text was updated successfully, but these errors were encountered: