Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

hi @Göran Lundqvist

hope you are doing good.

I implemented this whole process and got this same error, but when I used id_token instead of access_token it worked for me. what is the use of access_token then?

 

thanks

Hammad

@Raghav Sharma Can you please help me on how can I get okta access token using servienow api.

We have a requirement to get details from hr system for that first we need to get access token from okta. I generated the client ID and secret in OKTA, and created an Oauth profile in servicenow.

rajkumar5
Tera Contributor

@Raghav ,I used "id_token" value in Authorization instead of using  "access_token "and selected "inherit from parent,unfortunately I'm getting same error "User Not Authenticated"

1)

find_real_file.png

2)

find_real_file.png

3)

find_real_file.png

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

@mageshkumar if you want we can connect on zoom and I'll show you what I have done on my side.