Pages

Thursday, February 11, 2010

The security token could not be authenticated or authorized

When we use X.509 certificates with web services we might get this exception:


System.Exception: Soap error:Message:The security token could not be authenticated or authorized


This mostly means the certificate that was used by the server/client for encryption/signature is not valid on our machine. One solution would be to add it or its issuer cert to our trusted store.

An interesting case where we may get this error is after we have added the certificate to the store. This is usually a result of caching made by the windows store. Such caching is used in order to prevent DOS attacks. Wait a few minutes until changes take effect...

7 comments:

  1. Thanks a lot..
    this helped me a lot

    ReplyDelete
  2. In Visual Studio this seems to be WSE537 error. Adding the certificate to local store doesn't help. The issuer is already added but this don't work. Any ideas?

    ReplyDelete
  3. In Visual Studio this seems to be WSE537 error. Adding the certificate to local store doesn't help. The issuer is already added but this don't work. Any ideas?

    ReplyDelete
  4. Hi Piotr

    When things get messed up with certificates authentication I like to install the relevant certificates in each one of the stores (in local machine or current user) and see what happens... if this works I remove them one by one.

    Of course it can still be the issue is something else. If you have a working client compare the outgoing message to its message.

    ReplyDelete
  5. The interesting thing here is that the web service receive and process the message, the problem is only on the client side. This tells that problem is only on client machine, right?

    ReplyDelete
  6. Success! I've added the CA to local computer store and that did the trick! :)

    ReplyDelete