Rest with Bearer Tokens - ClientId and Client Secret ?'s

If someone has a desire to use Bearer token to access Epicor Rest API’s,
the Ice.Lib.TokenService.GetAccessToken call takes:

{
  "clientId": "00000000-0000-0000-0000-000000000000",
  "clientSecret": "string",
  "scope": "string"
}

where do I find or generate these values ?
what are the intended values for scope ?

Thanks
2 Likes

I believe it’s a GET on Ice.Lib.TokenServiceSvc BO

Correction: It’s a POST to that service.

1 Like

Indeed that works, thanks !

1 Like

Hmmm, not quite working,

So what I did was use the Epicor REST API Help website and called that method,
and then used it in Postman to make a test call

The return from the TokenService call did show a Bearer token value in the curl section, but not in the response.

And if I try the TokenService in Postman, I only get this as the response

I’ve not taken the time to program it in a function, but wondering why it does not work in Postman

1 Like

Try using the bearer from the curl and testing it in Postman

Yes, I did that and it worked, but I want to get the Bearer token using postman and when I call the TokenService in postman it’s not returned

2 Likes

GetAccessToken I believe.

2 Likes

Yeah, that was what I tried originally (see first entry above), but it wants a clientId and client secret, not sure where those come from

I’m on my phone.

@Olga , @josecgomez

It’s not a Get method you’ll have to use post

curl --location --request POST 'https://YourEpicor.Com/EpicorLive10/TokenResource.svc/' \
--header 'username: YourEpicorUserName' \
--header 'password: YourEpicorPassword' \
--header 'Accept: application/json'

This will responde with

{
    "AccessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiO_SNIP_CAUSE_H4K3RZ",
    "ExpiresIn": 28800,
    "TokenType": "Bearer"
}
5 Likes

strangley, I get a 404 not found

it was tripping on a 401 unathorized at first, adding the API key got past that

I know my path to my epicor instance is correct as I am using it in other calls

headers look correct from curl

I’m Saas, does that matter ?

No it doesn’t matter, are you willing to share the URLs?

It’s here

https://server/instance/TokenResource.svc
1 Like

Awesome, that did it, thanks !!!

1 Like

this works too without clientid & secret

Then you must still send APIKey headers on subsequent requests even with Bearer Token. :zany_face:

1 Like