TestProject Forum

Gradle project execution giving an error of invalid token [SOLVED]

Hi,
I am getting this error when I try to run my gradle project.
Exception in thread “main” io.testproject.sdk.internal.exceptions.InvalidTokenException: No token has been provided.

Could you please guide me?

Hello @suranga1201.

Did you insert your dev token when creating the driver in your test?

You can get a dev token from the integrations section:

And construct your driver using it, for example:

ChromeDriver driver = new ChromeDriver("DEV_TOKEN" ,new ChromeOptions(), "PROJECT_NAME");

You can also set your dev token as an environment variable as mentioned in the GitHub documentation:

1 Like

I had TP_DEV_TOKEN updated in environment variables.
Also construct drivers using this template:
ChromeDriver driver = new ChromeDriver(“DEV_TOKEN” ,new ChromeOptions(), “PROJECT_NAME”).

It did not work.

In the and I figured it out after debugging that code was using my previous dev token which I updated in the environment variables. So I restarted pc and now it takes my updated dev token.

Hi,
If you encounter dev_token invalid, and you set-up everything in the environment variables correctly, please perform a restart as some IDEs only refresh these variables on system start.