public/helper/Send-TwitterOauth_AccessToken.ps1
function Send-TwitterOauth_AccessToken { <# .SYNOPSIS Authentication .DESCRIPTION POST oauth/access_token Allows a Consumer application to exchange the OAuth Request Token for an OAuth Access Token. This method fulfills Section 6.3 of the OAuth 1.0 authentication flow. .PARAMETER oauth_verifier If using the OAuth web-flow, set this parameter to the value of the oauth_verifier returned in the callback URL. If you are using out-of-band OAuth, set this value to the pin-code. For OAuth 1.0a compliance this parameter is required. OAuth 1.0a is strictly enforced and applications not using the oauth_verifier will fail to complete the OAuth flow. .NOTES This helper function was generated by the information provided here: https://developer.twitter.com/en/docs/basics/authentication/api-reference/access_token #> [CmdletBinding()] Param( [string]$oauth_verifier ) Begin { [hashtable]$Parameters = $PSBoundParameters $CmdletBindingParameters | ForEach-Object { $Parameters.Remove($_) } [string]$Method = 'POST' [string]$Resource = '/oauth/access_token' [string]$ResourceUrl = 'https://api.twitter.com/oauth/access_token' } Process { # Find & Replace any ResourceUrl parameters. $UrlParameters = [regex]::Matches($ResourceUrl, '(?<!\w):\w+') ForEach ($UrlParameter in $UrlParameters) { $UrlParameterValue = $Parameters["$($UrlParameter.Value.TrimStart(":"))"] $ResourceUrl = $ResourceUrl -Replace $UrlParameter.Value, $UrlParameterValue } $OAuthSettings = Get-TwitterOAuthSettings -Resource $Resource Invoke-TwitterAPI -Method $Method -ResourceUrl $ResourceUrl -Parameters $Parameters -OAuthSettings $OAuthSettings } End { } } |