def METHOD_NAME(self, req, level):
    code = req.GET.get("code")
    params = {"grant_type": "authorization_code", "code": code, "client_id": TRAINASONE_CLIENT_ID, "client_secret": TRAINASONE_CLIENT_SECRET, "redirect_uri": WEB_ROOT + reverse("oauth_return", kwargs={"service": "trainasone"})}
    response = requests.post(TRAINASONE_SERVER_URL + "/oauth/token", data=params)
    if response.status_code != 200:
        raise APIException("Invalid code")
    data = response.json()
    authorizationData = {"OAuthToken": data["access_token"]}
    id_resp = requests.get(TRAINASONE_SERVER_URL + "/api/sync/user", headers=self._apiHeaders(authorizationData))
    return (id_resp.json()["id"], authorizationData)