datadaddy
(Scott Janisch)
June 13, 2025, 5:47pm
1
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
Randy
(Randy Stulce)
June 13, 2025, 5:48pm
2
I believe it’s a GET on Ice.Lib.TokenServiceSvc BO
Correction: It’s a POST to that service.
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"
}
1 Like
datadaddy
(Scott Janisch)
June 13, 2025, 5:57pm
3
Indeed that works, thanks !
1 Like
datadaddy
(Scott Janisch)
June 16, 2025, 5:40pm
4
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
Randy
(Randy Stulce)
June 16, 2025, 6:00pm
5
Try using the bearer from the curl and testing it in Postman
datadaddy
(Scott Janisch)
June 16, 2025, 6:04pm
6
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
klincecum
(Kevin Lincecum)
June 16, 2025, 6:09pm
7
Pretty sure you can using the appropriate request through the Ice.LIB.TokenServiceSvc.
[image]
GetAccessToken I believe.
2 Likes
datadaddy
(Scott Janisch)
June 16, 2025, 6:12pm
8
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
josecgomez
(Jose C Gomez)
June 16, 2025, 6:18pm
10
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
datadaddy
(Scott Janisch)
June 16, 2025, 6:33pm
11
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 ?
josecgomez
(Jose C Gomez)
June 16, 2025, 6:39pm
12
No it doesn’t matter, are you willing to share the URLs?
josecgomez
(Jose C Gomez)
June 16, 2025, 6:53pm
14
It’s here
https://server/instance/TokenResource.svc
1 Like
datadaddy
(Scott Janisch)
June 16, 2025, 6:54pm
15
Awesome, that did it, thanks !!!
1 Like
jbooker
(Josh Booker)
June 16, 2025, 7:47pm
16
this works too without clientid & secret
Then you must still send APIKey headers on subsequent requests even with Bearer Token.
1 Like