none
nuget.exe push with ApiKey switch throws not valid Base-64 error

    Question

  • I am trying to push nuget package using nuget.exe, nuget.config to Nexus repository.
    I have set the apikey in apikeys section of nuget.config file.
    Now when i execute nuget.exe with -configfile and -ApiKey switches it succesfully pushes the package to Nexus repository
    nuget.exe push test.nupkg -ConfigFile D:\nuget.config -NonInteractive -ApiKey 33077815-5d04-386c-afd3-603a86f0a4e2

    Since i have already given the apikey in nuget.config file, i am trying to avoid -Apikey switch in nuget push command.
    when i execute nuget.exe with -configfile switch alone it throws below error
    nuget.exe push test.nupkg -ConfigFile D:\nuget.config -NonInteractive

    Error: "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters."

    Thanks.

    Thursday, January 07, 2016 2:26 PM

Answers

  • Hi,

    It is possible for you to run the nuget SetApiKey command to save the APIKey in a config file under your %APPDATA% folder. 

    Then the next time you run the nuget.exe push test.nupkg command, it is not need to add the -apikey argument. 

    Please check this link for the details: http://blog.davidebbo.com/2011/03/saving-your-api-key-with-nugetexe.html 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 11, 2016 6:21 AM
    Moderator

All replies

  • Hi,

    Could you please share some of your code here so that we could troubleshooting the issue.

    >>"The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters."

    I did a research for the error message.

    And the cause of the error is probably that it's getting converted to a modified Base64

    If that's the case, you need to change it back:

    For example:

    System.Convert.FromBase64String(base64String);

    The following document is about Convert.FromBase64String Method for your reference:

    https://msdn.microsoft.com/en-us/library/system.convert.frombase64string(v=vs.100).aspx

    Also I found a similar thread for your reference:

    http://stackoverflow.com/questions/15114044/the-input-is-not-a-valid-base-64-string-as-it-contains-a-non-base-64-character

    Hope that could be helpful to you.

    Best Regards,

    Lake Xiao

    Friday, January 08, 2016 6:20 AM
    Moderator
  • Hi lake Xiao,

    I did not write any code to push nuget package.
    I used nuget.exe with above said commands to push the nuget package.
    The error is thrown from nuget.exe.
    The above error is not thrown when we set the apikey both in nuget.config and nuget.exe -setapikey switch.
    The above error is thrown only when we set the apikey in nuget.config and nuget.exe is not set with -setapikey switch.
    Since i already specified apikey in nuget.config i dont want to repeat in -setapikey switch of nuget.exe. 

    Thanks.

    Friday, January 08, 2016 8:43 AM
  • Hi,

    Currently I think I am not able to help you solve this issue. But I will invite some Microsoft senior engineer for further troubleshooting.

    Thanks for your understanding.

    Best Regards,

    Lake Xiao

    Monday, January 11, 2016 2:04 AM
    Moderator
  • Hi,

    It is possible for you to run the nuget SetApiKey command to save the APIKey in a config file under your %APPDATA% folder. 

    Then the next time you run the nuget.exe push test.nupkg command, it is not need to add the -apikey argument. 

    Please check this link for the details: http://blog.davidebbo.com/2011/03/saving-your-api-key-with-nugetexe.html 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 11, 2016 6:21 AM
    Moderator