Getting error "User not Authenticated" when trying to make REST calls using OAuth 2.0 with okta

rajkumar5
Tera Contributor

1) I have created new application in okta .Attached screenshot in below :

find_real_file.png

find_real_file.png

2) And i've created OIDC Provider configuration in servicenow instance and configured client id and secret which is copied from Okta.

 And enabled "User Provisioning"find_real_file.png

find_real_file.png

And in the OIDC Provider Configuration User Claim "email" is mapped to sys_user field (Email).

find_real_file.png

I've also created a user, where the Email field contains the value of my Okta user email value. I've also added some roles(include admin,security admin,api access ) to the user.

find_real_file.png

I have got the access token from Okta but when i send this to inbound table API GET method, i'm getting error message


"error": {
"message": "User Not Authenticated",
"detail": "Required to provide Auth information"
},
"status": "failure"
}

find_real_file.png

Could you please help me on this issue?

Thanks!

1 ACCEPTED SOLUTION

can you please show me the user account cuz its working for me here are my setting for user provisiong on application registery.

i would recommend you to delete the user account and configure the following settings and dont forget to use the id_token

find_real_file.png

here is the data srouce configuration

find_real_file.png 

 

here is the transform map configuration 

find_real_file.png

 

 

thanks 

Hammad

View solution in original post

19 REPLIES 19

rajkumar5
Tera Contributor
@raghav and @Goran, Issue not resolved... Still looking for best answer 😐

Just so I get this clear. You want to use this for login but it doesn't work. And if you use it with postman it doesn't work either? Or are you using this to reach an endpoint on an instance where you are authentication through okta (OAuth)?

//Göran
Feel free to connect:
LinkedIn
Subscribe to my YouTube Channel
or look at my Book: The Witch Doctor's Guide To ServiceNow

hammad ul aziz2
Mega Guru

Hi, @mageshkumar 

i implemented the whole process the problem is that the user in servicenow needs to have the same password as okta profile only then it will grant access to that API.

 

and make sure that user has a rest_service role granted.

 

please mark this correct and helpful if this helped you in any way.

 

thanks

hammad

 

RaghavSh
Kilo Patron

@mageshkumar follow below steps:

1. Request new token and copy "id_token" not "access_token" it is below the "access token",

2. Set the authentication to "inherit from parent".

3. In the "headers" pass authentication as Bearer <space> <id_token from step1>

find_real_file.png

 
 

 


Raghav
MVP 2023

I think Raghav is on the right track here. you seem to use the access token instead of the id token.

//Göran
Feel free to connect:
LinkedIn
Subscribe to my YouTube Channel
or look at my Book: The Witch Doctor's Guide To ServiceNow