/Ubisecure.OAuth2

PowerShell OAuth 2.0 Client for Ubisecure SSO

Primary LanguagePowerShellApache License 2.0Apache-2.0

PowerShell OAuth 2.0 Client for Ubisecure SSO

Depends on Ubisecure.QueryString, Ubisecure.HttpListener

Used by Ubisecure.SSO.Management

Install from github.com

Windows

cd /d %USERPROFILE%\Documents\WindowsPowerShell\Modules
git clone https://github.com/psteniusubi/Ubisecure.OAuth2.git

Linux

cd ~/.local/share/powershell/Modules
git clone https://github.com/psteniusubi/Ubisecure.OAuth2.git

Example

$client = New-OAuthClientConfig -Json @"
{
    "redirect_uris":  [
                          "http://localhost/public"
                      ],
    "grant_types":  [
                        "authorization_code"
                    ],
    "client_id":  "public",
    "client_secret":  "public"
}
"@

$code = Get-OAuthAuthorizationCode -Client $client -Authority "https://login.example.ubidemo.com/uas" -Browser "default"

$token = Get-OAuthAccessToken -Client $client -Authority "https://login.example.ubidemo.com/uas" -Code $code

Get-OAuthUserInfo -Authority "https://login.example.ubidemo.com/uas" -Bearer $token