@@ -74,25 +74,6 @@ def _extract_items_from_creds_dict(self, creds):
7474 id_access_token = creds .get ("id_access_token" )
7575 return client_secret , id_server , id_access_token
7676
77- def create_id_access_token_header (self , id_access_token ):
78- """Create an Authorization header for passing to SimpleHttpClient as the header value
79- of an HTTP request.
80-
81- Args:
82- id_access_token (str): An identity server access token.
83-
84- Returns:
85- list[str]: The ascii-encoded bearer token encased in a list.
86- """
87- # Prefix with Bearer
88- bearer_token = "Bearer %s" % id_access_token
89-
90- # Encode headers to standard ascii
91- bearer_token .encode ("ascii" )
92-
93- # Return as a list as that's how SimpleHttpClient takes header values
94- return [bearer_token ]
95-
9677 @defer .inlineCallbacks
9778 def threepid_from_creds (self , id_server , creds ):
9879 """
@@ -168,20 +149,15 @@ def bind_threepid(self, creds, mxid, use_v2=True):
168149 use_v2 = False
169150
170151 # Decide which API endpoint URLs to use
171- headers = {}
172152 bind_data = {"sid" : creds ["sid" ], "client_secret" : client_secret , "mxid" : mxid }
173153 if use_v2 :
174154 bind_url = "https://%s/_matrix/identity/v2/3pid/bind" % (id_server ,)
175- headers ["Authorization" ] = self .create_id_access_token_header (
176- id_access_token
177- )
155+ bind_data ["id_access_token" ] = id_access_token
178156 else :
179157 bind_url = "https://%s/_matrix/identity/api/v1/3pid/bind" % (id_server ,)
180158
181159 try :
182- data = yield self .http_client .post_json_get_json (
183- bind_url , bind_data , headers = headers
184- )
160+ data = yield self .http_client .post_json_get_json (bind_url , bind_data )
185161 logger .debug ("bound threepid %r to %s" , creds , mxid )
186162
187163 # Remember where we bound the threepid
0 commit comments