@@ -74,25 +74,6 @@ def _extract_items_from_creds_dict(self, creds):
74
74
id_access_token = creds .get ("id_access_token" )
75
75
return client_secret , id_server , id_access_token
76
76
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
-
96
77
@defer .inlineCallbacks
97
78
def threepid_from_creds (self , id_server , creds ):
98
79
"""
@@ -168,20 +149,15 @@ def bind_threepid(self, creds, mxid, use_v2=True):
168
149
use_v2 = False
169
150
170
151
# Decide which API endpoint URLs to use
171
- headers = {}
172
152
bind_data = {"sid" : creds ["sid" ], "client_secret" : client_secret , "mxid" : mxid }
173
153
if use_v2 :
174
154
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
178
156
else :
179
157
bind_url = "https://%s/_matrix/identity/api/v1/3pid/bind" % (id_server ,)
180
158
181
159
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 )
185
161
logger .debug ("bound threepid %r to %s" , creds , mxid )
186
162
187
163
# Remember where we bound the threepid
0 commit comments