Skip to content

issue sending Custom message parameters for end point "/admin/v1/phones/$phone_id/send_sms_activation" #5

@Ramtecspdx

Description

@Ramtecspdx

Sorry for the long message and your PSDuo module is awesome, I am building other functions upon it. Thank you!
Issue:

The endpoint /admin/v1/phones/$phone_id/send_sms_activation" has parameters : install = 1 (for send install link), installation_msg to send the installation custom or default installation message and activation_msg to send the custom activation message or else it will send the default activation message.
Testes in tandem with postman indicated that there is nothing wrong with the end point and parameters when the request is sent in the [form : Post https://apixxxxxxx.duosecurity.com/admin/v1/phones/DPphoneID7Q2X4/send_sms_activation?install=1&installation_msg=Please install ..&activation_msg=please activate ...
And the phone receives the custom messages so I know there is no problem with end point and parameters.
Based on your awesome work, I created a new function called SendDuoActivationLink see attached file
Send-DuoActivationLink.txt

The results of my function show that all the parameters needed are in the body

PS C:\WINDOWS\system32> Send-DuoActivationLink -phone_id DPxyzphone_idQ2X4 -Install 1
Ramses parameters:

Name Value


activation_msg
install 1
installation_msg
phone_id DPxyzphone_idQ2X4
Ramses APiParams:

Key : phone_id
Value : DPxyzphone_idQ2X4

Key : Install
Value : 1

Ramses DUORequest:
ContentType application/x-www-form-urlencoded
Method POST
Body {[phone_id, DPxyzphone_idQ2X4], [Install, 1]}
Headers {X-Duo-Date, Authorization}
URI Https://api-zxycustida50.duosecurity.com/admin/v1/phones/DPxyzphone_idQ2X4/send_sms_activation

activation_barcode : https://api-zxycustida50.duosecurity.com/frame/qr?value=duo%3A%2Xyzrandoml66rZxqPgNcyFzLjM1-YXBpLTRjYzRlYTRyzrandonb3NlY3VyaXR5LmNvbQ
activation_msg : To activate the Duo Mobile app, click this link: https://m-zxycustida50.duosecurity.com/iphone/5Hl66rZxqPgNcyXYZRandom
valid_secs : 86400

PS C:\WINDOWS\system32> Send-DuoActivationLink -phone_id DPxyzphone_idQ2X4 -Install 1 -installation_msg 'install ' -activation_msg 'activate '
Ramses parameters:

Name Value


activation_msg activate
install 1
installation_msg install <insturl.
phone_id DPxyzphone_idQ2X4
Ramses APiParams:

Key : phone_id
Value : DPxyzphone_idQ2X4

Key : Install
Value : 1

Key : installation_msg
Value : install <insturl.

Key : activation_msg
Value : activate

Ramses DUORequest:
ContentType application/x-www-form-urlencoded
Method POST
Body {[phone_id, DPxyzphone_idQ2X4], [Install, 1], [installation_msg, install <insturl.], [activation_msg, activate ]}
Headers {X-Duo-Date, Authorization}
URI Https://api-zxycustida50.duosecurity.com/admin/v1/phones/DPxyzphone_idQ2X4/send_sms_activation
Invoke-RestMethod : {"code": 40103, "message": "Invalid signature in request credentials", "stat": "FAIL"}
At C:\Users\blahblah\Documents\WindowsPowerShell\Modules\PSDuo\Public\Send-DuoActivationLink.ps1:46 char:17

  • $Response = Invoke-RestMethod @DuoRequest
    
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
      WARNING: DUO REST Call Failed
      WARNING:
      Key Value

phone_id DPxyzphone_idQ2X4
Install 1
installation_msg install
activation_msg activate

WARNING: Method:POST Path:/admin/v1/phones/DPxyzphone_idQ2X4/send_sms_activation

So my question is if the parameters show up correctly in the body, why is it that is not passing any parameters other than phone_id? if install = 1 would pass then they default messages install and activation message would have been sent, but no. Postman with only install =1 did sent the two messages but it does not happen in powershell.
So I think something needs to be adjusted in Covertto-duo request between lines 68 to 87,
I doubled checked the concatenation and escape data strings for the $APIParams where you stringify the parameters but that checks out fine.

The error message is : Invoke-RestMethod : {"code": 40103, "message": "Invalid signature in request credentials", "stat": "FAIL"}

Any ideas folks?

Thank you in advance,
Rami
Lo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions