Skip to content

Setup key authentication

For Zervicepoint Powershell Management

When authenticating towards the Zervicepoint PowerShell API you now have two options. Either use ADFS or a Key. ADFS requires the ADFS service running in your environment which provides tokens to prove your identity. Using a key does not require any additional services as the key itself proves your identity. This guide covers how to change from using ADFS for our API to instead use Key.

Instructions

To change from ADFS to Key authentication follow these steps

  1. Go to AdminWeb, Edit Store, API Authentication tab
  2. Click the Authentication method dropdown and select Key edit store
  3. Fill out the email-address of the user who you want to add API rights for add user
  4. Click on Generate key and the following modal will be shown copy key
  5. Make sure you copy the Key as it will only be shown once.
  6. Click Close

    Make sure you click Save

  7. Now the basic setup is done. To use your key start up PowerShell where you have the Zervicepoint PowerShell Management API installed. In the code example below we assume you are running PowerShell from the Zervicepoint server as the module is installed in the default location

  8. Run the following line of code to import the module

    Import-Module "C:\Program Files\Zipper\ZervicePoint\Powershell\ZervicePoint.WebApi.PowerShell"
    
  9. Then run the following code to put the key you just generate into a credential on the machine you are running PowerShell from. The credential will be linked to the store specified in the URL, configure the key on the local machine

    $url = "https://zervicepoint.dev.local:30000/Store/"
    Set-ZPKeyCredential -Key "Un+cfCbIAYT69bZwz6MR8TJd9LJ0iCFwh6/r/RY3H5M=" -Url $url
    
  10. Now you can run the usual cmdlets like Get-ZPStore

    Get-ZPOrder example
    Get-ZPOrder -Url $url
    
  11. It is also possible to skip Set-ZPKeyCredential by supplying a Key directly in the Key parameter when making common calls using the API

    Get-ZPOrder -Key "Un+cfCbIAYT69bZwz6MR8TJd9LJ0iCFwh6/r/RY3H5M=" -Url $url