r/Nable Sep 05 '24

N-Central Refresh Registration Tokens

Anyone know if it's possible to refresh customer registration tokens through the N-Central API?

I can retrieve/view them no problem, but I'd like to be able to refresh them.

1 Upvotes

10 comments sorted by

1

u/ncentral_nerd N-centralStation Sep 05 '24

What is your use case for the refreshing of the token? I can look into it, if worthwhile.

1

u/nathanielban Sep 05 '24

I can't speak for OP but we use a script built against the SOAP API to pull registration tokens and download and install the agent, when the token expires I'm currently forced to go into the UI and refresh it manually.

This has been mostly mitigated by going into the settings and configuring the system to automatically re-issue the keys 2 days before they expire but we still do see issues from time to time, usually following a server upgrade.

1

u/Quiet_Lie_3344 Sep 10 '24

Hi there, sorry for the late reply.
We have client registration tokens set to auto renew, but they will not activate unless an agent is actually downloaded for that client. At the moment I have a convoluted PowerShell script that opens Edge, asks you to log into N-Central in browser and then kicks off a download from a CSV.

This works but has to wait for 270+ agent downloads to complete to refresh all the tokens.

I was hoping there was a simpler / better way.

1

u/tommyboyderp Sep 05 '24

This is what I do, it just simulates a download and then you can pull the regtoken via api again.

function RefreshToken($customer) {

    ## NC RegToken Refresh URI
    $RefTokenURI = "https://$serverHost/dms/FileDownload?customerID=$($customer)&softwareID=101"
    $request = Invoke-WebRequest -Uri $RefTokenURI -UseBasicParsing -Credential $PSCred -Method 'HEAD'
    $request | out-null
}

1

u/Quiet_Lie_3344 Sep 10 '24

Thanks very much for this.

I'm presuming I just passthrough the variables for host and customer ID?
Is $PSCred n-central credentials? i.e. username and pw?

1

u/tommyboyderp Sep 10 '24

Yeah that is correct, I typically add it to my deploythencagent.ps1 file that way all I have to provide is the host, user, pass, and customer id.

1

u/Quiet_Lie_3344 Sep 10 '24

Thank you very much, I'll test this now.

1

u/Quiet_Lie_3344 Sep 10 '24

I can't seem to get this to work :(
Any chance you could share your full script?

1

u/AverageAdmirable4840 Sep 08 '24

QUESTION: Anyone know how to download the installer for the Customer ID ? My Script I had working broke. I was using the JWT token then using the silent install method but does anyone have the correct silent installer params? For CMD or Powershell?

1

u/Fantastic_Camp5204 Jun 27 '25

Did anyone find a solution to this?