Coder Social home page Coder Social logo

Comments (4)

JosephMcEvoy avatar JosephMcEvoy commented on June 19, 2024 1

#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.

from pszoom.

noaboa97 avatar noaboa97 commented on June 19, 2024

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.

from pszoom.

JosephMcEvoy avatar JosephMcEvoy commented on June 19, 2024

from pszoom.

noaboa97 avatar noaboa97 commented on June 19, 2024

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.

from pszoom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.