MCPcopy Create free account
hub / github.com/comaps/comaps / FinishAuthorization

Function FinishAuthorization

tools/python/oauth2-flow/oauth2_flow.py:164–185  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

162 return oauthCode
163
164def FinishAuthorization(code):
165 payload = urllib.parse.urlencode({
166 "grant_type": "authorization_code",
167 "code": code,
168 "redirect_uri": OAuthRedirectUri,
169 "scope": OAuthScope,
170 "client_id": OAuthClientId,
171 })
172
173 headers = { 'content-type': "application/x-www-form-urlencoded" }
174
175 conn = http.client.HTTPSConnection(osmHost)
176 conn.request("POST", "/oauth2/token", payload, headers)
177
178 res = conn.getresponse()
179 if res.status >= 400:
180 print(res.status)
181 print(res.headers)
182 print(res.read().decode('utf-8'))
183 raise Exception("Error getting OAuth2 token")
184
185 return res.read().decode("utf-8")
186
187
188def FindAuthenticityToken(formAction, htmlCode):

Callers 2

oauth2_flow.pyFile · 0.85
FetchAccessTokenMethod · 0.85

Calls 1

readMethod · 0.45

Tested by

no test coverage detected