Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zoom API JWT Tokens deprecation and replacement #68

Closed
PowershellNinja opened this issue Jul 19, 2022 · 4 comments · Fixed by #69 or #71
Closed

Zoom API JWT Tokens deprecation and replacement #68

PowershellNinja opened this issue Jul 19, 2022 · 4 comments · Fixed by #69 or #71

Comments

@PowershellNinja
Copy link

As stated in https://marketplace.zoom.us/docs/guides/build/jwt-app/jwt-faq/, Zoom has deprecated JWT tokens and is going to completely remove them by June 2023, the replacement is called OAuth apps.
Are there any plans to build OAuth-App based authentication into this module?

@noaboa97
Copy link
Contributor

So I didn't investigate a lot, but on first sight it seems, that a new function is needed. New-ZoomOAuthApiToken or something like that. Which replaces New-ZoomApiToken. Also New-ZoomHeaders needs some code change to support New-ZoomOAuthApiToken.

Are my assumptions correct?

I already managed to create a Server-to-Server OAuth app, request the token and list all users, without the PSZoom Module.
Trying now to figure out how to integrate it.

@JosephMcEvoy
Copy link
Owner

JosephMcEvoy commented Jul 20, 2022 via email

@noaboa97
Copy link
Contributor

noaboa97 commented Jul 20, 2022

Here's what I've got. Currently no error handling of any kind.

function New-ZoomOAuthApiToken {

    <#
    .SYNOPSIS
    Retrieves the Zoom OAuth API token
    .DESCRIPTION
    Retrieves the Zoom OAuth API token

    .PARAMETER ClientID
    Client ID of the Zoom App

    .PARAMETER ClientSecret
    Client Secret of the Zoom App

    .PARAMETER AccountID
    Account ID of the Zoom App
    
    .OUTPUTS
    Zoom API Response

    .NOTES
    Version:        1.0
    Author:         noaboa97
    Creation Date:  20.07.2022
    Purpose/Change: Initial function development
  
    .EXAMPLE
    $clientid = "YourClientID"
    $clientsecret = "YourClientSecret"
    $AccountID = "YourAccountID"

    Get-XMCToken -ClientID $clientid -ClientSecret $clientsecret -AccountID $AccountID

    .EXAMPLE
    $token = Get-XMCToken -ClientID $clientid -ClientSecret $clientsecret -AccountID $AccountID
    #>

    [CmdletBinding()]
    param (
        [Parameter(valuefrompipeline = $true, mandatory = $true, HelpMessage = "Enter Zoom App Client ID:", Position = 0)]
        [String]
        $ClientID,

        [Parameter(valuefrompipeline = $true, mandatory = $true, HelpMessage = "Enter Zoom App Client Secret:", Position = 1)]
        [String]
        $ClientSecret,

        [Parameter(valuefrompipeline = $true, mandatory = $true, HelpMessage = "Enter Zoom App Account ID", Position = 2)]
        [String]
        $AccountID
    )


    $Uri = "https://zoom.us/oauth/token?grant_type=account_credentials&account_id={0}" -f $AccountID

    #Encoding of the client data
    $IDSecret = $ClientID + ":" + $ClientSecret 
    $EncodedIDSecret = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($IDSecret))

    $headers = @{
        "Authorization" = "Basic $EncodedIDSecret"  
    }
            
    # Maybe add some error handling
    $response = Invoke-WebRequest -uri $Uri -headers $headers -Method Post 

    return $response

}

Have a look if you have time, in the mean time I will check how I can integrate and keep you up to date.

@JosephMcEvoy JosephMcEvoy linked a pull request Aug 8, 2022 that will close this issue
@JosephMcEvoy
Copy link
Owner

#71 I didn't really like how I handled retrieving the token from Zoom, so I used this as an opportunity to revamp things. I pushed a new version to PowerShell Gallery, dropping support for JWT while introducing a new cmdlet named Connect-PSZoom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants