'Error while generating urn and authenticate code to view file

My first project with forge is just about finished but I am completely stuck on the last part. My app configures a part according to a json file. And exports it as an stp. The download also works perfectly. But now I would like to receive an urn and the authenticate code.

I now receive an urn back and a authenticate code but something seems wrong. When I paste this in an html file that I found with an example where you only have to paste the urn and the authenticate code. Does he not show the model.

Can anyone see where my error is?

Below is the code I am using now

   public string GetTokenHeader()
    {
        if (Token.IsValid())
            return Token.GetHeader();

        var client = new RestClient(Url);

        RestRequest request = new RestRequest("authentication/v1/authenticate", Method.POST);
        request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
        request.AddParameter("client_id", Key);
        request.AddParameter("client_secret", Secret);
        request.AddParameter("grant_type", "client_credentials");
        request.AddParameter("scope", AuthScope);

        IRestResponse response = client.Execute(request);
        Token = JsonConvert.DeserializeObject<ForgeToken>(response.Content);

     

        if (Token == null)
        {
            Console.WriteLine("Call to get an Access token failed. Please check the enviroment variables FORGE_CLIENT_ID and/or FORGE_CLIENT_SECRET and also the configuration files for a proper end points.");
            return "";
        }

        if (!Token.IsValid())
            Console.WriteLine("Access token is not valid.\nThat usually means that enviroment variables FORGE_CLIENT_ID and/or FORGE_CLIENT_SECRET are not set properly.");


        return Token.GetHeader();
    }





   private static async Task<string> gettest(bool strFile)
    {
        ForgeRestResponse response = await s_ForgeDmClient.GetBucketObjectDetails(getOutputBucketKey(), s_Config.OutputPartLargeFile);


        string test = response.GetResponseContentProperty("objectId");


        //Console.WriteLine(response.GetType());
        //Console.WriteLine(response.ToString());
        Console.WriteLine(response.IsSuccessStatusCode());
        var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(test);
        return System.Convert.ToBase64String(plainTextBytes); ;

    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source