Could not authenticate you, code 32 (Very possibly an API bug?)

Hi,
This status_message:

#SubtileosJamSessions
 
Session: 030
Year: 2019

Session Theme
===========

#HealTheLove (#newsong) 

* Improve second stanza lyrics.
* Create new progression.
* Update melody.
* Finish the introduction.
* Add final.

#SJS03019
#music #songwriting #poetry #art #creativity #test

Gives me the response: “Could not authenticate you”
The status is given as valid by twitter-text:

Twitter::TwitterText::Validation.parse_tweet(status)
=> {:weighted_length=>279, :valid=>true, :permillage=>996, :valid_range_start=>0, :valid_range_end=>278, :display_range_start=>0, :display_range_end=>278}

I’m using twurl to do the API call:
twurl -d “status=’#{status}’” “/1.1/statuses/update.json”
If I remove ‘*’ and replace it by ‘-’ like in the following example it is posted without any issues.

I believe this can only be a bug?

#SubtileosJamSessions
 
Session: 030
Year: 2019

Session Theme
===========

#HealTheLove (#newsong) 

- Improve second stanza lyrics.
- Create new progression.
- Update melody.
- Finish the introduction.
- Add final.

#SJS03019
#music #songwriting #poetry #art #creativity #test

Actually it seems that any message that includes a like hello *’ can not authenticate.

Hi @Asharika, try to encode the status before posting it

Hi @Brithi. I did that. The encoding doesn’t change the ‘*’ character and only adds size to the status.
The encoding expressions that I tried:

status_encoded = ERB::Util.url_encode(status)
status_encoded = URI.encode(status)
status_encoded = CGI.escape(status)

All of them fail with the same error message for the * hello * status.
Also note that status.encoding returns UTF-8.

Yes UTF-8 won’t change *

You should replace it with %2A

What do you mean UTF-8 won’t change ‘*’?

UTF-8 is the character encoding.

What should URL encode the characters is one of the options inside the code block of my last comment.
Besides, why a character would raise a “could not authenticate you” error message?

I can confirm it passed with the encoding.

I still think there is a bug here though.

Another issue is that when we encode the character counting is completely different from the one we get on the UI.
Isn’t it a bug as well? Shouldn’t we be allowed to send encoded status that matches the UI status we can submit?

Also: why ‘*’ needs to be encoded to not get an authentication error but other characters like ‘\n’, ‘•’, ’ ’ or ‘#’ do not?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.