Perform LinkedIn OAuth Authentication
li_oauth.Rd
The li_oauth
function facilitates OAuth
2.0 authentication for interacting with
the LinkedIn API. It uses the authorization
code flow to generate an OAuth token.
Value
An OAuth token object (of class
httr2_token
) that can be used to
authenticate subsequent API requests to
LinkedIn.
Details
The function performs the following steps:
Calls
li_client()
to initialize the OAuth client using the LinkedIn client ID and secret (stored as environment variables:LI_CLIENT_ID
andLI_CLIENT_SECRET
).Constructs the authorization URL with the required state, scope, and client details.
Executes the authorization code flow using
httr2::oauth_flow_auth_code
, which:Prompts the user to allow access.
Supports redirection to
http://localhost:1444/
to complete the authorization process.Specifies required LinkedIn permissions (scope): email, openid, profile, and w_member_social.