twilio / twilio-go

A Go package for communicating with the Twilio API.
MIT License
290 stars 40 forks source link

Messaging API and SubAccounts #209

Closed mlh758 closed 1 year ago

mlh758 commented 1 year ago

Issue Summary

A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, or code examples.

Listing services does not seem to respect sub account configuration.

Steps to Reproduce

  1. I have a function that takes a sub account SID and returns a new client, basically just the docs:
    func LoginSubAccount(sid string) *twilio.RestClient {
    return twilio.NewRestClientWithParams(twilio.ClientParams{
    AccountSid: sid,
    })
    }
  2. Make a call to list services for the sub account:
    params := &messaging.ListServiceParams{}
    params.SetLimit(100)
    client.MessagingV1.ListService(params)

Instead of seeing services for the sub account, I see services for the parent account.

Code Snippet

# paste code here

Exception/Log

# paste exception/log here

Technical details:

mlh758 commented 1 year ago

I see: https://www.twilio.com/docs/iam/api/subaccounts#authentication

This sub account authentication only works for the 2010 API, the other APIs don't support this. Might be worth calling out in the docs but otherwise, not a bug.