Invalid token provided

Hello to all, I am having an issue with the below error message. I have seen others have had the same problem but I have not seen a documented solution (or at least more than one).

I have recently setup a developer account as well as postman. I have imported the Okta collection API’s into postman and followed the steps to create a token and update my environment with my domain and new token.

When trying the simple get user list API, I get the below error. It seems like the message is straight forward however the token is not expired as I just created it and is valid for another 30 days so what else can make it invalid?

I am not able to see any other logs on Okta side showing the reject or reason why.

Does anyone have any other ideas about what could cause this error?

{
“errorCode”: “E0000011”,
“errorSummary”: “Invalid token provided”,
“errorLink”: “E0000011”,
“errorId”: “oae41rLbwhMQg6sww8I3hb37g”,
“errorCauses”: []
}

Thanks,

John

Hi @ironjohn

Can you please open a support ticket through an email to support@okta.com with this issue, along with the timestamp when you did the request? One of our support engineers will take the case and assist you in narrowing down the cause of the issue.

yes i will do that. thank you.

This issue was resolved. in addition to adding the API key (token) to postman key “initial value”, it needed to also be added to “current value” apparently it is not automatic

I am faceing same issue,following is my java code. inplace of apitoken we created the token in on security-api-create token and copied the same token as apii-token.

public static void main(String[] args)
{
Client client = Clients.builder()
.setOrgUrl(“https://Sirahu-dev-726203.okta.com”) // e.g. https://dev-123456.okta.com
.setClientCredentials(new TokenClientCredentials(“secret_api_token”))
.build();

    User user = UserBuilder.instance()
        .setEmail("joe.coder@example.com")
        .setFirstName("Joe")
        .setLastName("Code")
        .buildAndCreate(client);
}

any one please help me on this

Could you please share the solution which you done ,still i am facing same issue .
following is my java code. and created api-token also in security-api-create token

import com.okta.sdk.authc.credentials.TokenClientCredentials;
import com.okta.sdk.client.Client;
import com.okta.sdk.client.Clients;
import com.okta.sdk.resource.user.User;
import com.okta.sdk.resource.user.UserBuilder;

public class SpringCache1
{
public static void main(String[] args)
{
Client client = Clients.builder()
.setOrgUrl(“https://Sirahu-dev-726203.okta.com”) // e.g. https://dev-123456.okta.com
.setClientCredentials(new TokenClientCredentials(“SSWS secret_api_token”))
.build();

    User user = UserBuilder.instance()
        .setEmail("joe.coder@example.com")
        .setFirstName("Joe")
        .setLastName("Code")
        .buildAndCreate(client);

}

}

do we need to change any privileges to admin

Hi @mvadlamudi,

You shouldn’t add the SSWS prefix in setClientCredentials method.

Change it to
setClientCredentials(new TokenClientCredentials("secret_api_token")
and it should work.

Also, please don’t share your API tokens anywhere. It can be used to access/delete data in your org.

If that still fails, generate a new API token from admin dashboard and use it, as old one might have expired.

Regards,
Vijet

After removing SSWS also facing same issue.do I need to do any other configuration.

Thanks & Regards,
Madhurima Vadlamudi

Hi @mvadlamudi,

I’m not sure what could be the issue here.
I suggest you do the following -

  1. Use postman/curl to make the same API call and see if it works
  2. If that still doesn’t work, create a new API token and try postman/curl.

From the postman its working fine for me ,the issue is with sdk only.

Thanks & Regards,

Which version of SDK are you using?
Also, can you create a yaml file in ~/.okta/okta.yaml and add your API Token there as described here?

i am using the same documentation,the following is the okta sdk version.

<okta.sdk.version>1.5.4</okta.sdk.version>

Thanks & Regards,
Madhurima vadlamudi

Sorry I am using the oka spring boot project ,just i cloned the code from git https://github.com/okta/okta-sdk-java.git.
I will execute this and let you know if there are any issues.

Thanks and Regards,
Madhurima Vadlamudi

Thanks Vijet for nice support,
Now it’s working fine and the problem is with domain url,we used an org name .
just we need to remove the admin and we can use the url(https://dev-726203.okta.com/ )

Thanks & Regards,
Madhurima vadlamudi

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.