Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8628899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:40:09+00:00 2026-06-12T08:40:09+00:00

I’m trying to create a client for the new tent.io protocol that’s being developed

  • 0

I’m trying to create a client for the new tent.io protocol that’s being developed and they are using the HTTP MAC Oauth2 scheme described by https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-http-mac-01.

I’ve written a simple method in C# that creates the Authorization header, but when I submit my request I get a simple "Invalid MAC signature" error.

Since I don’t have a reference implementation, I’m struggling to figure out what’s wrong with my code. I’m posting it here in the hope that somebody can spot my mistake.

public string GetAuthorizationHeader(string macKeyIdentifier, string macKey, string macAlgorithm, string method, Uri uri)
{
    TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
    string timestamp = ((int)t.TotalSeconds).ToString();

    string nonce = new Random().Next().ToString();

    string normalizedString = string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n\n", 
                                            timestamp, 
                                            nonce, 
                                            method,
                                            uri.PathAndQuery, 
                                            uri.Host, 
                                            uri.Port);

    HashAlgorithm hashGenerator = null;
    if (macAlgorithm == "hmac-sha-256")
    {
        hashGenerator = new HMACSHA256(Encoding.ASCII.GetBytes(macKey));
    }
    else if (macAlgorithm == "hmac-sha-1")
    {
        hashGenerator = new HMACSHA1(Encoding.ASCII.GetBytes(macKey));
    }
    else
    {
        throw new InvalidOperationException("Unsupported MAC algorithm");
    }

    string hash = System.Convert.ToBase64String(hashGenerator.ComputeHash(Encoding.ASCII.GetBytes(normalizedString)));

    StringBuilder authorizationHeader = new StringBuilder();
    authorizationHeader.AppendFormat(@"id=""{0}"",ts=""{1}"",nonce=""{2}"",mac=""{3}""",
                                     macKeyIdentifier, timestamp, nonce, hash);

    return authorizationHeader.ToString();
}

I create the full header using the returned value and it looks something lke this

Authorization: MAC id="a:dfsdfa2",ts="1349277638",nonce="1469030797",mac="ibZ/HXaoz2VgBer3CK7K9vu0po3K+E36K+TQ9Sgcw6o="

I’m sure I’m missing something small, but I cannot see it.

Any help would be very much appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:40:10+00:00Added an answer on June 12, 2026 at 8:40 am

    It turns out the code above is perfect, but I was passing the wrong HTTP method value into it!

    Where I was getting the error, I was POST’ing JSON, but I had actually put “GET” into the GetAuthorizationMethod!

    Once I’d corrected that, I got an access_token value from Tent.is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am using Paperclip to handle profile photo uploads in my app. They upload
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.