Error: OAuth Access or Refresh tokens are not available. when setting up GitLab Spoke

Karlie_Yates
Kilo Contributor

I'm in the process of setting up GitLab Spoke in my ServiceNow instance, and I'm having trouble getting my Access token to authenticate. Does anyone have some insight on this issue? I'm also having trouble creating a Token URL that actually works.

I'm not sure if this could be effecting it, but my GitLab instance uses HTTP, not HTTPS.

When I try to use GitLab spoke in flow designer, I get the error: "Method failed: (/api/v4/projects/12/repository/branches/master) with code: 401 - Invalid username/password combo"

Lastly, My redirect URL which follows this setup: "http://<instance>.service-now.com/oauth_redirect.do" yields this error: 

"Your OAuth redirect failed. Please check if the redirect URL setup in your OAuth configuration matches your ServiceNow instance URL."

Any Help is appreciated. Attached are some screenshots of my OAuth profile for GitLab and my GitLab credential page..

 

1 REPLY 1

Stephane11
Giga Contributor

Hello,

 

In System OAuth > Application Registry > Your Application Registry Record

First of all, in the authorization URL, remove all the GET parameters (everything after '?'), as you have dedicated fields for client, secret and redirect uri, in the app registry form.

It should be like this: 

https://<yourgitlabdomain>/oauth/authorize

 

In the token url, you should have a url like this: 

https://<yourgitlabdomain>/oauth/token

 

In the redirect url, you should have something like this:

https://<yourservicenowinstancedomain>/api/sn_gitlab_spoke/gitlab_oauth_redirect/oauth

 

Source documentation: https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/administer/integrationhub-store-spokes/task/setup-gitlab-spoke.html

 

Then, you should go to Gitlab Token Management > Gitlab Token Management,

And update/create 1 Gitlab Token Management record that will have

- reference to the right OAuth profile (created automatically when Application Registry record created)

- same secret as in the app registry record

 

Finally, in the credential record, you should:

- select the right OAuth profile (same as in the Token Management record)

- click on get Get OAuth Token, and should be able to retrieve this successfully

 

PS: You shouldn't share any confidential information on the community for security reasons (addresses, ips, ports, authentication informations, etc); so I invite you to remove it from your post, or hide it..