1
0
Fork 0
mirror of synced 2024-06-02 18:34:37 +12:00

Send HTTP200 when oauth2 is successful

This commit is contained in:
Ali Parlakci 2021-03-27 23:17:37 +03:00
parent 265505efc7
commit 2e879949f5

View file

@ -62,6 +62,7 @@ class OAuth2Authenticator:
self.send_message(client)
raise RedditAuthenticationError(f'Error in OAuth2: {params["error"]}')
self.send_message(client, "<script>alert('You can go back to terminal window now.')</script>")
refresh_token = reddit.auth.authorize(params["code"])
return refresh_token
@ -80,8 +81,8 @@ class OAuth2Authenticator:
return client
@staticmethod
def send_message(client: socket.socket):
client.send('HTTP/1.1 200 OK'.encode('utf-8'))
def send_message(client: socket.socket, message: str):
client.send(f'HTTP/1.1 200 OK\r\n\r\n{message}'.encode('utf-8'))
client.close()