Skip to content

Commit

Permalink
Merge pull request #42 from latchbio/kenny/url-patch
Browse files Browse the repository at this point in the history
fix: cert patch
  • Loading branch information
ayushkamat authored Apr 30, 2022
2 parents 4903998 + 9c22447 commit 68d7bc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion latch/auth/oauth2.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import http.server
import json
import ssl
import urllib
import urllib.request
import webbrowser

import certifi

from latch.auth.csrf import CSRFState
from latch.auth.pkce import PKCE
from latch.constants import OAuth2Constants
Expand Down Expand Up @@ -172,7 +175,9 @@ def access_token_request(self, auth_code: str) -> str:
).encode("utf-8")
token_request = urllib.request.Request(token_url, token_body)
token_request.add_header("Content-Type", "application/json")
with urllib.request.urlopen(token_request) as f:
with urllib.request.urlopen(
token_request, context=ssl.create_default_context(cafile=certifi.where())
) as f:
try:
json_response = json.loads(f.read().decode("utf-8"))
id_token = json_response["id_token"]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setup(
name="latch",
version="0.7.0",
version="0.7.1",
author_email="kenny@latch.bio",
description="latch sdk",
packages=find_packages(),
Expand Down

0 comments on commit 68d7bc2

Please sign in to comment.