external help file: PSRAW-help.xml Module Name: PSRAW online version: https://psraw.readthedocs.io/en/latest/Module/Connect-Reddit schema: 2.0.0
Connect-Reddit
SYNOPSIS
Authenticates to the Reddit API
SYNTAX
Connect-Reddit [[-ClientCredential] <PSCredential>] [[-UserCredential] <PSCredential>] [[-RedirectUri] <Uri>]
[<CommonParameters>]
DESCRIPTION
Connect-Reddit
simplifies the process of authenticating to the Reddit API. It asks for only the minimum amount of information necessary to obtain an OAuth token for a Script
application. Connect-Reddit
only supports Script
applications and is intended for One-Off scripts and console usage. If you do not supply all of the required information you will be interactively prompted for missing data.
You must still register a Script
application at https://www.reddit.com/prefs/apps before you can us Connect-Reddit
.
If you are planning to use PSRAW for long running process or bots, you will want to use New-RedditApplication
and Request-RedditOAuthToken
to properly define your application to comply with Reddit's API rules. It is possible to edit the OAuth Access Token and Application generated by Connect-Reddit
by using Get-RedditDefaultOAuthToken
to retrieve th current session token.
EXAMPLES
Example 1
PS C:\> connect-reddit
This will start an interactive prompt for all the required data.
PARAMETERS
-ClientCredential
The ClientCredential
is a PSCredential
where the username is the Client ID and the password is the Client Secret from the Script
application you registered at https://www.reddit.com/prefs/apps.
Type: PSCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-RedirectUri
The Redirect Uri is the Redirect URI of the Script
application you registered at https://www.reddit.com/prefs/apps.
Type: Uri
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-UserCredential
A PSCredential
containing the Reddit username and password of the Reddit user account used to register the script application.
Type: PSCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
None
OUTPUTS
System.Void
NOTES
This command is intended only for interactive sessions.
For more information about registering Reddit Apps, Reddit's API, or Reddit OAuth see:
- https://github.com/reddit/reddit/wiki/API
- https://github.com/reddit/reddit/wiki/OAuth2
- https://www.reddit.com/prefs/apps
- https://www.reddit.com/wiki/api
RELATED LINKS
https://psraw.readthedocs.io/en/latest/Module/Connect-Reddit
https://github.com/reddit/reddit/wiki/API
https://github.com/reddit/reddit/wiki/OAuth2