Skip to content

Commit a057c04

Browse files
committed
Fix authorization_url and access_token_url variables resolution (like facebook backend)
1 parent e388257 commit a057c04

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/fastapi_oauth2/core.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import json
23
import random
34
import re
@@ -33,7 +34,8 @@ def absolute_uri(self, path=None) -> str:
3334
return path
3435

3536
def get_setting(self, name) -> Any:
36-
"""Mocked setting method."""
37+
""" settings from environment """
38+
return os.getenv(name, '')
3739

3840
@staticmethod
3941
def get_json(url, method='GET', *args, **kwargs) -> httpx.Response:
@@ -64,8 +66,8 @@ def __init__(self, client: OAuth2Client) -> None:
6466
self.provider = client.backend.name
6567
self.redirect_uri = client.redirect_uri
6668
self.backend = client.backend(OAuth2Strategy())
67-
self._authorization_endpoint = client.backend.AUTHORIZATION_URL
68-
self._token_endpoint = client.backend.ACCESS_TOKEN_URL
69+
self._authorization_endpoint = self.backend.authorization_url()
70+
self._token_endpoint = self.backend.access_token_url()
6971
self._oauth_client = WebApplicationClient(self.client_id)
7072

7173
@property

0 commit comments

Comments
 (0)