< Back
Get-ODAuthentication
Post
NAME Get-ODAuthentication
SYNOPSIS
SYNTAX
Get-ODAuthentication [-ClientId] <String> [[-Scope] <String>] [[-RedirectURI] <String>] [[-AppKey] <String>]
[[-RefreshToken] <String>] [[-ResourceId] <String>] [-DontShowLoginScreen] [-AutoAccept] [-LogOut]
[<CommonParameters>]
DESCRIPTION
Connect to OneDrive for authentication with a given client id (get your free client id on
https://apps.dev.microsoft.com) For a step-by-step guide:
https://github.com/MarcelMeurer/PowerSh ... y-OneDrive
PARAMETERS
-ClientId <String>
ClientId of your "app" from https://apps.dev.microsoft.com
Required? true
Position? 1
Default value unknown
Accept pipeline input? false
Accept wildcard characters? false
-Scope <String>
Comma-separated string defining the authentication scope (https://dev.onedrive.com/auth/msa_oauth.htm).
Default: "onedrive.readwrite,offline_access". Not needed for OneDrive 4 Business access.
Required? false
Position? 2
Default value onedrive.readwrite,offline_access
Accept pipeline input? false
Accept wildcard characters? false
-RedirectURI <String>
Code authentication requires a correct URI. Use the same as in the app registration e.g.
http://localhost/logon. Default is https://login.live.com/oauth20_desktop.srf. Don't use this parameter for
token-based authentication.
Required? false
Position? 3
Default value https://login.live.com/oauth20_desktop.srf
Accept pipeline input? false
Accept wildcard characters? false
-AppKey <String>
The client secret for your OneDrive "app". If AppKey is set the authentication mode is "code." Code
authentication returns a refresh token to refresh your authentication token unattended.
Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RefreshToken <String>
Refreshes the authentication token unattended with this refresh token.
Required? false
Position? 5
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ResourceId <String>
Mandatory for OneDrive 4 Business access. Is the ressource URI: "https://<tenant>-my.sharepoint.com/".
Example: "https://sepagogmbh-my.sharepoint.com/"
Required? false
Position? 6
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DontShowLoginScreen [<SwitchParameter>]
Suppresses the logon screen. Be careful: If you suppress the logon screen you cannot logon if your credentials
are not passed through.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-AutoAccept [<SwitchParameter>]
In token mode the accept button in the web form is pressed automatically.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-LogOut [<SwitchParameter>]
Performs a logout.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Author: Marcel Meurer, marcel.meurer@sepago.de, Twitter: MarcelMeurer
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>$Authentication=Get-ODAuthentication -ClientId "0000000012345678"
$AuthToken=$Authentication.access_token
Connect to OneDrive for authentication and save the token to $AuthToken
RELATED LINKS
SYNOPSIS
SYNTAX
Get-ODAuthentication [-ClientId] <String> [[-Scope] <String>] [[-RedirectURI] <String>] [[-AppKey] <String>]
[[-RefreshToken] <String>] [[-ResourceId] <String>] [-DontShowLoginScreen] [-AutoAccept] [-LogOut]
[<CommonParameters>]
DESCRIPTION
Connect to OneDrive for authentication with a given client id (get your free client id on
https://apps.dev.microsoft.com) For a step-by-step guide:
https://github.com/MarcelMeurer/PowerSh ... y-OneDrive
PARAMETERS
-ClientId <String>
ClientId of your "app" from https://apps.dev.microsoft.com
Required? true
Position? 1
Default value unknown
Accept pipeline input? false
Accept wildcard characters? false
-Scope <String>
Comma-separated string defining the authentication scope (https://dev.onedrive.com/auth/msa_oauth.htm).
Default: "onedrive.readwrite,offline_access". Not needed for OneDrive 4 Business access.
Required? false
Position? 2
Default value onedrive.readwrite,offline_access
Accept pipeline input? false
Accept wildcard characters? false
-RedirectURI <String>
Code authentication requires a correct URI. Use the same as in the app registration e.g.
http://localhost/logon. Default is https://login.live.com/oauth20_desktop.srf. Don't use this parameter for
token-based authentication.
Required? false
Position? 3
Default value https://login.live.com/oauth20_desktop.srf
Accept pipeline input? false
Accept wildcard characters? false
-AppKey <String>
The client secret for your OneDrive "app". If AppKey is set the authentication mode is "code." Code
authentication returns a refresh token to refresh your authentication token unattended.
Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RefreshToken <String>
Refreshes the authentication token unattended with this refresh token.
Required? false
Position? 5
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ResourceId <String>
Mandatory for OneDrive 4 Business access. Is the ressource URI: "https://<tenant>-my.sharepoint.com/".
Example: "https://sepagogmbh-my.sharepoint.com/"
Required? false
Position? 6
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DontShowLoginScreen [<SwitchParameter>]
Suppresses the logon screen. Be careful: If you suppress the logon screen you cannot logon if your credentials
are not passed through.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-AutoAccept [<SwitchParameter>]
In token mode the accept button in the web form is pressed automatically.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-LogOut [<SwitchParameter>]
Performs a logout.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Author: Marcel Meurer, marcel.meurer@sepago.de, Twitter: MarcelMeurer
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>$Authentication=Get-ODAuthentication -ClientId "0000000012345678"
$AuthToken=$Authentication.access_token
Connect to OneDrive for authentication and save the token to $AuthToken
RELATED LINKS