HOME / COMMUNITY Switch to knowledge base

API: Invalid Login Credentials

#1

Using vb.net to connect to quickfile api, I’m getting a constant invalid login credentials error.

I’ve checked the md5 hash its generating along with ensuring the sequence number is incrementing. I’ve checked the permissions for my app through the QF interface 3rd party area, in fact I added all permissions just in case. Just doing a client_search at the moment, but getting the error with client_get as well.

Any idea what else I can check.

0 Likes

#2

Have you checked your App ID, Account number and API Key?

0 Likes

#3

There’s a section on the API authentication mechanism here:

Authentication Mechanism

Here’s some VB.NET code you can use to MD5 encrypt the string:

'MD5 ENCRYPT STRING
Function md5Encrypt(ByVal input As String) As String
    Dim md5 As New Encryption.Hash(Encryption.Hash.Provider.MD5)
    Dim encData As New Encryption.Data
    encData.Text = input
    Dim hashData As Encryption.Data = md5.Calculate(encData)
    Dim encryptedResponse As String = hashData.ToHex.ToLower
    Return encryptedResponse
End Function

Also check the case on the API key, I don’t know if it makes a difference but in our test cases it goes in as upper case.

0 Likes

#4

thanks for the quick replies. I have copied the keys literally off of the QF page so I didn’t mistype anything. I’ll try your code Glenn, though I have been checking the one mine produces with the MD5 tool site suggested. i’ll let you know if it still persists.

1 Like

#5

i’ve rechecked all the keys and ID. and the md5 hash is coming out the same as md5tools. But the key being sent as upper case doesn’t make a difference for me it seems.

Also @Glenn what library should I import as your code doesn’t seem to like System.Security.Policy that the error help wanted to append to the module.

Invalid error still occurring :frowning:

0 Likes

#6

Oh my fault, the MD5 function depends on the following library:

Encryption.zip (10.6 KB)

Once you include this in your project it should work. This function should generate an MD5 hash consistent with the following tool:

http://www.allhype.co.uk/tools/md5/

EDIT:

Also make sure you’re including the API Key in the plain text before hashing not the APP ID. I just made that mistake myself while testing.

The API Key can be found in the account settings area.

0 Likes

#7

thanks @Glenn for the file. Your code gives the same result as the one I’m using. BUT… neither gives the same md5 value as what the sandbox area gives, yet plug the stringtohash into allhypes tool and they give me the same result as me, not the sandbox.

Now I am even further confused… as still getting invalid login. Yet using the sandbox md5 value I get through the login

0 Likes

#8

In the sandbox if I concatenate the following (in the order specified) and manually run it through the allhype.co.uk MD5 tool it produces the same output as the <MD5Value> in the preloaded example request.

In my example I only have one application called aaaaa.

If you change any of the fields you can reload it by clicking here:

0 Likes

#9

thanks @Glenn, I can see where I was doing it wrong. I used the app key in the hash, instead of the API key… something like that. Much appreciate everyone taking their time to help.

login was successful and got some xml back again

0 Likes

#10

I guessed so, if you see my edit further up I raised this possibility as when testing I made exactly the same mistake :smile:

EDIT:

Also make sure you’re including the API Key in the plain text before hashing not the APP ID. I just made that mistake myself while testing.

The API Key can be found in the account settings area.

0 Likes

#11

u can see how new I am to this interface… school boy error!! [hangs head in shame]

0 Likes

#12

btw… thanks @Parker1090 I should have checked them more closely…

1 Like

#13

No problem :slight_smile: . Glad you got it sorted

0 Likes

#14

would this code work in VBA?

0 Likes

#15

@Rob I don’t believe so as the original example is based on VB.NET and I believe VBA predates .NET.

0 Likes