27 lines
703 B
Python
27 lines
703 B
Python
import requests
|
|
|
|
from . import builders
|
|
from .client import Client
|
|
|
|
|
|
def process_callback(client: Client, code: str) -> tuple[str, str, int]:
|
|
payload = {
|
|
'grant_type': 'authorization_code',
|
|
'code': code,
|
|
}
|
|
|
|
header = builders.build_callback_authorization_header(client)
|
|
|
|
response = requests.post(client.access_url,
|
|
data = payload,
|
|
headers = header)
|
|
data = response.json()
|
|
access_token: str = str(data["access_token"])
|
|
refresh_token: str = str(data["refresh_token"])
|
|
expires_in: int = int(data["expires_in"])
|
|
|
|
return (
|
|
access_token,
|
|
refresh_token,
|
|
expires_in
|
|
) |