Forum Discussion

mini84's avatar
mini84
Occasional Contributor
4 months ago

Adding a property variable in Access Token field returns invalid token.

Hi,

i'm using Soapui open source version 5.7.2

  1. I have a TestSuite1 with TestCase1  with a Request1 called login.
  2. After login i have a property transfer which retrieve the token and store it in a testsuite property called "test".
  3. I have a TestSuite2 with a TestCase2 with a Request2 called get_information, this request need the login token obtained in Resquest1 from the testsuite property "test"

 in Request2 set an Authorization Bearer with Acces Token,

in the Access Token field i wrote $(#TestSuite#test)

When i run TestSuite1 the login token is transferred in $(#TestSuite#test) 

When i run TestSuite2 the Request2 it returns 401 error : Token is invalid or expired

If i run replace $(#TestSuite#test)  the token value directly in Access Token field then the test is passed.

Question:

Why the Request2 returns error when im using the $(#Project#token) in Access Token field ?

I need to use the token in all request and the token is changing every minute.

Any help please?

Thank you 

32 Replies

  • mini84's avatar
    mini84
    Occasional Contributor

    Yes tried under :
    Project level
    TestSuite level
    TestCase level

    it returns the token is invalid
    it works only if write directly the value of the token in Access Token field

    If i check the value saved in properties i see the correct value.

    i don't understand why this value is not retrieved in the access token field.

    I tried to convert the value to string like this $(#Project#token).toString()

    i have the same issue. is it because it is open source version?

    • nmrao's avatar
      nmrao
      Champion Level 3

      Can you show the response of the login where token is present please? Have you tried groovy to extract and save token?

  • nmrao's avatar
    nmrao
    Champion Level 3

    Has the token saved under project level properties?