Skip to content

Commit

Permalink
Merge pull request #268 from MerleLiuKun/feat-business-login
Browse files Browse the repository at this point in the history
feat(login): ✨ add support for business login parameter conf…
  • Loading branch information
MerleLiuKun authored Aug 20, 2024
2 parents da33dd1 + 65e77dc commit a39b0f9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pyfacebook/api/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import re
import time
from urllib.parse import parse_qsl, urlparse
from typing import Dict, List, Optional, Tuple
from typing import Any, Dict, List, Optional, Tuple
from warnings import warn

import requests
Expand All @@ -30,6 +30,7 @@ class GraphAPI:
"v17.0",
"v18.0",
"v19.0",
"v20.0",
]
GRAPH_URL = "https://graph.facebook.com/"
AUTHORIZATION_URL = "https://www.facebook.com/dialog/oauth"
Expand Down Expand Up @@ -541,6 +542,7 @@ def get_authorization_url(
redirect_uri: Optional[str] = None,
scope: Optional[List[str]] = None,
state: Optional[str] = None,
url_kwargs: Optional[Dict[str, Any]] = None,
**kwargs,
) -> Tuple[str, str]:
"""
Expand All @@ -551,13 +553,17 @@ def get_authorization_url(
Note: Your redirect uri need be set to `Valid OAuth redirect URIs` items in App Dashboard.
:param scope: A list of permission string to request from the person using your app.
:param state: A CSRF token that will be passed to the redirect URL.
:param url_kwargs: Additional parameters for generate authorization url. like config_id.
:param kwargs: Additional parameters for oauth.
:return: URL to do oauth and state
"""
session = self._get_oauth_session(
redirect_uri=redirect_uri, scope=scope, state=state, **kwargs
)
authorization_url, state = session.authorization_url(url=self.authorization_url)
url_kwargs = {} if url_kwargs is None else url_kwargs
authorization_url, state = session.authorization_url(
url=self.authorization_url, **url_kwargs
)
return authorization_url, state

def exchange_user_access_token(
Expand Down

0 comments on commit a39b0f9

Please sign in to comment.