Revoke the access token using api okta restTemplate form batch

I need to revoke token okta form batch java , using restTemplat .
when I did the research sur okta dev , I found that must go through an API but the probleme
i"dont have okta_session_cookie , what I stored in the database at the time of connection is just the access token ,I am looking for a complete process to revoke the token, my point of entry is just the access token okta,

here is what i found

 HttpHeaders headers = new HttpHeaders();
    headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
    HttpEntity<?> entity = new HttpEntity(headers);
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(REVOKE_URL)
            .queryParam("token", tokenDetailsDto.getRefreshToken());
    LOGGER.info("used parameters:\n\turl={},\n\tentity={},\n\turiParameters={}", REVOKE_URL, entity);
    restTemplate.postForObject(builder.build().encode().toUri(), entity, Void.class);

@mohamedberrahal Can you pls try to test the API endpoint in postman first?

You can import Okta postman collections via the below reference:
https://developer.okta.com/docs/reference/postman-collections/

Hi Lijia,

I tried with this API too

in my okta dashbord I have

@mohamedberrahal Did you manually add the client id in Body? Why not add it in the authorization tab?
What type of application you have?

Yes i add client id in the autorisation , bat the problem persiste

@mohamedberrahal It looks like your client id is not correct. Also, the two screens you attached earlier is not revoke token. One is get token and another one is delete current session.
I suggest you to open a support ticket through an email to support@okta.com. One of our dev support engineers will help you review this API issue.

Merci Lijia, I create new ticket in okta support :pray: :pray: :pray:

helloo Lijia,

on okta support he asks me to go through dev forum :sweat: :sweat:

@mraible do you have any idea , thank you in advance for your return

As far as I know, access tokens can not be revoked, they just expire. That’s why we recommend having short-lived access tokens and long-lived refresh tokens.

ok thank you matt I understood, in other words I can do otherwise, to delete the user session via this API https://xxx.okta.com/api/v1/sessions/me ? as an entry point the 'access token no?
but I do not have the cookie session id, I am in a batch

It’s best to use our logout API when trying to end a user’s session.

We also have a guide that shows how to sign users out.

https://developer.okta.com/docs/guides/sign-users-out/react/sign-out-of-okta/

Yes, I see this example bat ,I have to do this from a java batch not a fornt application (like react angular) either , and the entry point that I have is the access token and the clientId : ‘0oaxxxxkkgkgxxx’ , really i’m blocking, if you have a proposal , thanks in advance matt

restTemplate.exchange( …

If you don’t have a ID Token, you can’t use the guides I suggested. I’d suggest having a short-lived access token instead. It’s possible there’s another technique, but I’m not familiar with it.