Я пытаюсь аутентифицировать API-интерфейс LinkedIn для получения данных со страниц компании, используя мои учетные данные в приложении LinkedIn.
В настройках Oauth 2.0:
URL-адреса перенаправления:
http://localhost:8000/
Не был полностью уверен, какие URL добавить выше.
from requests_oauthlib import OAuth2Session
from requests_oauthlib.compliance_fixes import linkedin_compliance_fix
# Credentials you get from registering a new application
client_id = '*********'
client_secret = '********'
redirect_url = 'http://localhost:8000/'
# OAuth endpoints given in the LinkedIn API documentation (you can check for the latest updates)
authorization_base_url ='https://www.linkedin.com/oauth/v2/authorization'
token_url = 'https://www.linkedin.com/oauth/v2/accessToken'
# Authorized Redirect URL (from LinkedIn configuration)
linkedin = OAuth2Session(client_id, redirect_uri=redirect_url)
linkedin = linkedin_compliance_fix(linkedin)
# Redirect user to LinkedIn for authorization
authorization_url, state =
linkedin.authorization_url(authorization_base_url)
print('Please go here and authorize,', authorization_url)
# Get the authorization verifier code from the callback url
redirect_response = input('Paste the full redirect URL here:')
# Fetch the access token
linkedin.fetch_token(token_url, client_secret=client_secret,
authorization_response=redirect_response)
# Fetch a protected resource, i.e. user profile
r = linkedin.get('https://api.linkedin.com/v1/people/~')
print(r.content)
После открытия URL-адреса, входа в систему и авторизации клиента я получаю эту ошибку:
InvalidClientIdError: (invalid_request) Отсутствует обязательный параметр "client_id"
Я уверен, что это самые последние URL-адреса для использования в LinkedIn