Coder Social home page Coder Social logo

Comments (9)

kaopectate avatar kaopectate commented on June 19, 2024 1

ran that test "new-oauthtoken" script and it errored out on my win 10 machine, but worked fine on server. i believe this is due to changes in behavior of IE. when launched on win 10 machine it closes and launches new edge.

Also why are you not just using Invoke-RestMethod ?

from pszoom.

JosephMcEvoy avatar JosephMcEvoy commented on June 19, 2024

The command looks well formatted to me. I tested 2.0.1.0 in PowerShell 5 and 7, and it's working as suspected. I also tried entering wrong credentials and the same error was returned. I suspect it's with how the app was set up or the credentials are not correct.

from pszoom.

AstroFish849 avatar AstroFish849 commented on June 19, 2024

I've re-created the app and still getting the same error
ConvertFrom-Json : Cannot bind argument to parameter 'InputObject' because it is null.

from pszoom.

JosephMcEvoy avatar JosephMcEvoy commented on June 19, 2024

I would try making the calls using a plain powershell script or even testing your app with Postman. See https://marketplace.zoom.us/docs/guides/guides/postman/using-postman-to-test-zoom-apis/. The script at the bottom of this comment should return the following when succesful:

New-OAuthToken @params
VERBOSE: POST with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: Acquired token.
System.Security.SecureString

or error:

New-OAuthToken @params
VERBOSE: POST with 0-byte payload
VERBOSE: received -byte response of content type application/json

Name                           Value
----                           -----
error                          invalid_client
reason                         Invalid client_id or client_secret
VERBOSE: Acquired token.

Here's the script:

function New-OAuthToken {
    <#
    .SYNOPSIS
    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
    
    #>

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

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

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

    )

    $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"  
    }
            
    try {
        $response = Invoke-WebRequest -uri $uri -headers $headers -Method Post -UseBasicParsing
    } catch {
        ConvertFrom-Json $_.errorDetails -AsHashtable
    }

    Write-Verbose 'Acquired token.'
    $token = ($response.content | ConvertFrom-Json).access_token
    $token = ConvertTo-SecureString -String $token -AsPlainText -Force
    Write-Output $token
}

$params = @{
    AccountID = '1234567891234567890123'
    ClientID = '12345678901234567890'
    ClientSecret = '12345678901234567890123456789012'
    Verbose = $True
}

New-OAuthToken @params

from pszoom.

JosephMcEvoy avatar JosephMcEvoy commented on June 19, 2024

Ah, this is likely related to internet explorer not being on your local computer. I still have to push those changes to the powershell gallery.

from pszoom.

JosephMcEvoy avatar JosephMcEvoy commented on June 19, 2024

The changes are pushed to the gallery. Please update your module and try again.

from pszoom.

AstroFish849 avatar AstroFish849 commented on June 19, 2024

Hey,
So running that script in Powershell works but just plain running the command Connect-PSZoom -AccountID 'XXXX' -ClientID 'XXXX' -ClientSecret 'XXXX' in powershell doesn't

Annoyingly I'm using Rundeck and not Postman - I'll do some Googling on this one

from pszoom.

AMARABDELLI avatar AMARABDELLI commented on June 19, 2024

Hello @JosephMcEvoy
I'm running into the same issue @AstroFish849 ran into. Were you guys able to find a solution?
image

from pszoom.

jwong00 avatar jwong00 commented on June 19, 2024

I think this is the issue I'm experiencing at the moment. It's not clear to me why IE is relevant to this issue, could someone please explain?

I've written a little test script that attempts the Connect-PSZoom with the accountid, clientid, and client secret. On my own machine, it works. On the server, it throws the same error messages others have screenshotted.

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.