Question

Access token isn't working

  • 17 April 2020
  • 7 replies
  • 838 views

Badge +2

Hi,

I’m trying to get the warehouse inventory list using a bearer token, I’m using ‘IFS Database’ as an identity provider.

I got my access token like this :

Then I used it like this :

 

But I’m getting a 401 error, I tried to use the id_token instead of the access_token but I get the same thing.

Am I missing something?

Thanks.


7 replies

Userlevel 6
Badge +18

Hi,

Will this connect flow diagram help you in narrowing down the possible cause for the 401 error?

 

Userlevel 3
Badge +5

Capitalize the B in bearer and use the id_token. 

Badge +2

With “Beared <Id_token> I get in the response a 401 and this in the header :

error="invalid_token", error_description="87f52886-8207-434e-878e-2160666616ed: The audience claims of the provided id token indicates that this is not an intended recipient."

 

I cannot request : /main/ifsapplications/projection/v1/CountReportsAnalysis.svc/CountingReports ?

Userlevel 4
Badge +9

@alexis Did you manage to resolve this issue… I’m facing the same issue right now

Userlevel 5
Badge +14

Hi,

 

I think the problem with Authorization. Try these steps. for more detail, you can check the @dsj tip from the link.  → Tip

 

Set Auth Header

  • Go to the Auth Tab,
  • Select Type as Basic Auth
  • Type IFS username and password to be used for the integration

Regards,

Hasan

Userlevel 3
Badge +3

Hello.

Judging by the screenshots provided in the post, I can see two things.

  1. The resource parameter in the token request is shorter than the client IDs. That’s not how it’s supposed to be. The correct value for a resource parameter is the same as the web client ID for database authentication.
  2. The access token you get is not a JWT token. This is consistent with what you would expect from a faulty resource parameter being used. 

Correct the resource parameter and I believe your token request should work and yield a good access token.

The ID token is also a JWT but it shouldn’t (can’t) be used like this.

Best regards, Björn.

Userlevel 7
Badge +20

Hi @alexis,

 

In Postman you can obtain the OAuth token directly. I’ve done it and worked fine. Only thing is you need to use the ID token instead of Access token.

I wrote a small blog post about how to do it. may be it will guide you to get it work :)

https://dsj23.me/2021/01/08/ifs-authentication-flow-with-oauth-and-openid-connect/

 

Cheers!
Damith

 

Reply