Skip to content

Latest commit

 

History

History

AuthApp

salesforce CLI authentication tool

GitHub license Build status NuGet feedz.io

Note: Pre-release packages are distributed via feedz.io.

Summary

This is a dotnet cli Saleforce Refresh and Access Tokens Generation tool.

buymeacoffee

Give a Star! ⭐

If you like or are using this project to learn or start your solution, please give it a star. Thanks!

Install DotNetCore Cli salesforce tool

    dotnet tool install salesforce -g

To verify the installation run:

     dotnet tool list -g

Usage of Salesforce dotnet cli tool

There are several ways to run this cli tool.

This tool will open web browser and will require you to log in with your credentials to Salesforce portal in order to retrieve the tokens.

  1. From any location with Consumer Key and Secret provided
    # specify the custom login url
    salesforce get-tokens --key:{key} --secret:{secret} --login:https://login.salesforce.com --verbose:information

    # use default login url
    salesforce get-tokens --key:{key} --secret:{secret} --verbose
  1. Running the tool in the directory that contains appsettings.json file with configurations
    salesforce get-tokens --section:Salesforce

Note: required configurations are as follows:

  "Salesforce": {
    "ClientId": "",
    "ClientSecret": "",
    "LoginUrl": ""
  }
  1. Running with Azure Vault

a.) Location with appsettings.json file

    "AzureVault": {
     "BaseUrl": "https://{name}.vault.azure.net/"
    },
    salesforce get-tokens --verbose:debug

b.) From any location

Or specify url within the dotnet cli tool like so:

    salesforce get-tokens --azure https://{name}.vault.azure.net/"

Tools possible switches

  • --key or -k (Salesforce Consumer Key)
  • --secret or -s (Salesforce Consumer Secret)
  • --login or -l (Salesforce login url)
  • --azure or -a (Azure Vault Url)
  • --azureprefix or ax (Use Environment prefix for Azure vault)
  • --configfile or -c (Specify configuration file)
  • --verbose:debug or --verbose:information or --verbose:trave
  • --usesecrets or us (Usually a Guid Id of the project that contains the secret)
  • --environment or -e (Production, Development, Stage)
  • --section or -sn (The root for the tools configuration the default is Salesforce)

Build self contained

rid-catalog

    # windows
    dotnet build -r win-x64 -c Release  -p:PackAsTool=false
    dotnet publish -r win-x64 -c Release  -p:PackAsTool=false -p:PublishSingleFile=true -p:PublishTrimmed=true -p:PublishReadyToRun=true -f netcoreapp3.0 -o ../../packages

    # linux
    dotnet build -r linux-x64 -c Release  -p:PackAsTool=false
    dotnet publish -r linux-x64 -c Release  -p:PackAsTool=false -p:PublishSingleFile=true -p:PublishTrimmed=true -p:PublishReadyToRun=false -f netcoreapp3.0 -o ../../packages