My Discord authorization token is 70 characters long, it goes as follows:
OTk1MTU1NzcyMzYxMTQ2NDM4.[6 characters].[38 characters]
But every token I see online is 59 characters long. Even the token grabbers only get the first 59 characters of my token. The regex everyone seem to use to know whether a string could be a token ( not MFA ) is /[\w-]{24}\.[\w-]{6}\.[\w-]{27}/ which clearly implies that there are 59 characters ( 57 + 2 periods ). Did the length of a token recently change?
PS: I successfully managed to make requests to the Discord API using it, it's valid.
Yes, the length of the discord tokens has changes over the time because of the decoded timestamp in the Base64 format in the token.
The Token is an encoded text as Text and the first letters are giving informations about the registration date of the user / bot.
example:
if I decode the token beginning I get the ID of the object.
In your case the ID of the bot would be 995155772361146438.
That's why it's changing.
Related
We are using Godaddy email server. We are trying fetch emails using IMAP protocol . Following are my sample IMAP commands
a select inbox
a UID SEARCH FROM "user1#server.com"
Results are getting fine for above commands something like below
* SEARCH 501 505 342 229 191
a OK SEARCH done.
If I write equivalent Java code for above commands , I'm getting empty results. Following is Java code.
IMAPFolder inbox = store.getFolder("INBOX");
SearchTerm fromTerm = new FromTerm(new InternetAddress("user1#server.com"));
Message[] messages = inbox.search(fromTerm);
The generated IMAP command for above Java code is
a SEARCH FROM user1#server.com ALL
but UID is missing in above java generated command so I'm getting empty results . How to include UID while using with Java
Thanks
The UID tag in the SEARCH command indicates that UIDs should be returned instead of message sequence numbers. Since JavaMail primarily works with message sequence numbers, it doesn't support UID SEARCH. It uses the returned message sequence numbers to map to the corresponding Message objects. Nonetheless, the messages should be "found" independently of whether their UIDs or their message sequence numbers are returned. If the server is only returning results for UID SEARCH, the server is broken and you should report this server bug to GoDaddy.
I have an input tag and on input it will filter a list of data in a table according to the input value. That value is passed via the query string in the request URL. Typically I get data returned and the table is updated appropriately. However, when searching for the pound sign (#), I am receiving a 500 internal server error. My question is there a known issue with Angular when passing a pound sign in the query string?
To pass reserved characters in URLs, you need to use percent encoding. For #, it's %23.
The wikipedia page for Percent Encoding has a nice lookup table.
I have an AppEngine app using the Google API Python Client to access the Fusion Tables API over OAuth. When trying to run UPDATE commands, the API client is putting my whole SQL statement into the query string in the URL.
So when I write a SQL statement like this...
UPDATE <table ID> SET <column> = 'some really long piece of text...' WHERE ROWID = '1'
...I get an API call like this:
POST https://www.googleapis.com/fusiontables/v1/query?sql=UPDATE+<table ID>+SET+<column>+%3D+%27some+really+long+piece+of+text...%27+WHERE+ROWID+%3D+%271%27&alt=json
All this works fine for most things. But I'm encountering errors when writing more than ~1,500 characters (depending on how many of those are special characters I have to escape) to that cell. The answer to another question says the limit to the number of characters in a cell is 1,000,000. I'm assuming this may be because the URL is getting just way too long (for something in the pipeline from AppEngine to the Fusion Tables API servers), maybe kind of like the issue addressed in this question.
With other APIs, I'm used to sending parameters in form data for POST requests not the query string, which keeps the URL a manageable size. But the Fusion Tables API docs seem to suggest that the query string is the proper place and that nothing should be sent in the request body. The API client seems to be dutifully following this pattern (and in fact using that as the default behavior for ALL Google APIs??).
So my question is threefold:
Does anyone know if the URL can get too long as I suspect is happening?
Is the query string really the only place to send the SQL statement or will if I find a way to include it in the request body will the API accept that?
If the query string really is the only way and it really can get too long, is there another way to post large strings to fusion table cells?
So I tried it. The answer to number 2 is that you CAN put the query in the request body as form data and the API will take it (contrary to what the docs suggest). My request to Fusion Tables from App Engine now looks like this:
import httplib2
import urllib
value = 'Some really long string...'
# http is an instance of httplib2.Http
http.request('https://www.googleapis.com/fusiontables/v1/query?alt=json',
method='POST',
body=urllib.urlencode({
'sql': unicode('UPDATE <table ID>' +
' SET <column>=\'' + value + '\'' +
' WHERE ROWID = \'1\'').encode('utf-8')
}),
headers={'Content-Type': 'application/x-www-form-urlencoded'})
Note that I believe the Content-Type header is necessary, but I haven't tried it without it.
I also left some unicode and UTF-8 encoding stuff in there because chances are, for anyone who needs to support a few thousand characters, a few of those characters might be non-ascii and urllib.urlencode doesn't like non-ascii characters...
I'd still appreciate an answer to numbers 1 and 3 if anyone has any more information, but this seems to work for me for now. I'm curious as to why using form data in the request body wasn't the default approach from the beginning for the Fusion Tables team...
I'm writing a basic client to access the Amazon SimpleDB service and I'm having some trouble understanding the logic behind the signing of the request.
Here is an example request:
https://sdb.amazonaws.com/?Action=PutAttributes
&DomainName=MyDomain
&ItemName=Item123
&Attribute.1.Name=Color&Attribute.1.Value=Blue
&Attribute.2.Name=Size&Attribute.2.Value=Med
&Attribute.3.Name=Price&Attribute.3.Value=0014.99
&Version=2009-04-15
&Timestamp=2010-01-25T15%3A01%3A28-07%3A00
&SignatureVersion=2
&SignatureMethod=HmacSHA256
&AWSAccessKeyId=<Your AWS Access Key ID>
Following is the string to sign.
The message to sign:
GET\n
sdb.amazonaws.com\n
/\n
AWSAccessKeyId=<Your AWS Access Key ID>
&Action=PutAttributes
&Attribute.1.Name=Color
&Attribute.1.Value=Blue
&Attribute.2.Name=Size
&Attribute.2.Value=Med
&Attribute.3.Name=Price
&Attribute.3.Value=0014.99
&DomainName=MyDomain
&ItemName=Item123
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Timestamp=2010-01-25T15%3A01%3A28-07%3A00
&Version=2009-04-15
Following is the signed request.
https://sdb.amazonaws.com/?Action=PutAttributes
&DomainName=MyDomain
&ItemName=Item123
&Attribute.1.Name=Color&Attribute.1.Value=Blue
&Attribute.2.Name=Size&Attribute.2.Value=Med
&Attribute.3.Name=Price&Attribute.3.Value=0014.99
&Version=2009-04-15
&Timestamp=2010-01-25T15%3A01%3A28-07%3A00
&Signature=<URLEncode(Base64Encode(Signature))>
&SignatureVersion=2
&SignatureMethod=HmacSHA256
&AWSAccessKeyId=<Your AWS Access Key ID>
What I don't get is the message to sign. Why don't I get it? well, the parameter order
is all changed around between the request and the message to sign. It appears in the example that maybe the parameters are ordered alphabetically.
Has anyone played around with SimpleDB to be able to tell me what the logic is behind the message to sign, i.e. parameter order etc. The documentation is not being very specific here.
To answer my own question.
The answer is buried in the documentation. I was right, I'm to sort the parameters first.
http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/index.html?Query_QueryAuth.html
For those reading this question later, below is a quote of the relevant section from the docs. This section seems to have disappeared from the SimpleDB docs but is still present in the SQS docs. It still applies directly to SimpleDB.
A key issue is that you have to properly URL encode all of the HTTP parameter values.
Do not URL encode any of the unreserved characters that RFC 3986
defines.
These unreserved characters are A-Z, a-z, 0-9, hyphen ( - ), underscore ( _ ), period ( . ), and tilde ( ~ ).
Percent encode all other characters with %XY, where X and Y are hex characters 0-9 and uppercase A-F.
Percent encode extended UTF-8 characters in the form %XY%ZA
Percent encode the space character as %20 (and not +, as common encoding schemes do).
A common error involves failure to encode the asterisk character (*) which can appear in both data values and in SelectExpressions.
I'm adding a field to a member table for twitter names for members on a site. From what I can work out the maximum twitter name length is 20 so it seems obvious that I should set the field size to varchar(20) (SQL Server).
Is this a good idea?
What if Twitter starts allowing multi-byte characters in the user names? Should I make this field nvarchar?
What if Twitter decides to increase the size of a username? Should I make it 50 instead and then warn a user if they enter a name longer than 20?
I'm trying to code defensively so that I can reduce the chances of modifying the code around this input field and the DB schema changes that might be needed.
while looking for the same info i found the following in a sort of weird place in the twitter help section (why not in the API docs? who knows?):
"Your user name can contain up to 15 characters. Why no more? Because we append your user name to your 140 characters on outgoing SMS updates and IM messages. If your name is longer than 15 characters, your message would be too long to send in a single text message."
http://help.twitter.com/entries/14609-how-to-change-your-username
so perhaps one could even get away with varchar(16)
While new accounts has a limit of 15 characters in the username and 20 characters in the name, for old accounts this limit seems to be undefined. The documentation here states:
Earlybirds: Early users of Twitter may have a username or real name longer than user names we currently allow. This is ok until you need to save changes to your account settings. No changes will save unless your user/real name is the appropriate length; this means you have to change your real name/username to meet our most modern regulations.
So you are probably better of having a long field and save yourself some time when you hit the border cases.
Nowadays, space is usually not a concern, so I'd use a mostly generic approach: use nvarchar(200).
When designing DB schemas you must think 2 steps ahead, even more than when programming. Or get yourself a good schema update strategy, then you'll be fine also with varchar(20).
Personally I wouldn't worry. Use something like 200 (or a nice round number like 256) and you won't have this problem. The limit then is on their API, so you might be best to do some verification that it is a real username anyway. That verification implicitly includes the length checking.
Twitter allows for 140 characters to be typed in as the message payload for transmission, and includes "[username]:" at the beginning of the SMS message. With an upper limit of 140 characters for the message combined with the messaging system being based on SMS, I think they would have to decrease the allowable message size to increase the username. I think it is a pretty safe bet that 20 characters would be the max username length. I'd use nvarchar just in case someone uses 16-bit characters, and maybe pad it a little. nvarchar(24) should work; I wouldn't go any higher than nvarchar(32).
If you're going to develop an app for their service, you should probably watch the messages on Twitter's API Announcements mailing list.
[opinion only]
Twitter works on SMS and the limit there is something like 256 characters, so the name has to be small to avoid hitting into the message.
nvarchar would be a good idea for all twitter text
If the real ID of a Twitterer is a cell-phone then the longest phone number is your max - 20 should easily cover it!
Defensive programming is always good :) !
[/opinion only]
There's only so much you can code defensively, I'd suggest looking at the twitter API documentation and following anything specified there. That said, from a cursory look through nowhere seems to specify the length of the username, annoyingly :/
One thing to keep in mind here is that a field using nvarchar needs twice as much space, since it needs 2 bytes to store each potential unicode character. So, a twitter status would need a size of 280 using nvarchar, PLUS some more for possible retweets, as those aren't inlcuded in the 140 char limit. I discovered this just today in fact!
For example:
RT #chatrbyte: here's some great tweet
that I'm retweeting.
The RT #chatrbyte: is not included in the 140 character limit.
So, assuming that a Twitter username has a 20 character limit, and wanting to also capture a ReTweet, a field to hold a full tweet would need to be a nvarchar of size 280 + 40 (for the username) + 8 (for the initial RT # before a retweet) +4 (for the :+space after a Retweet username) = 330.
I would say go for nvarchar(350) to give yourself a little room. That's what I am trying right now. If I'm wrong I'll update here.
I'm guessing you are managing the data entry on the Twitter name field in your application somewhere other than just in the database. If you open the field to 200 characters, you only have to change the code in one place or if you allow users to enter Twitters names with more than 20 characters, you don't have to worry about a change at all.