Skip to content

Error"invalid_grant" when trying to get access token.

I have a gitlab v 11.11.0 server in a docker with https configured. Our programmer is trying to execite a query

curl -v --url http://gittest.mydomain.com/oauth/token --header 'content-type: application/json' --data '{ "grant_type": "password", "username": "ldap_login", "password": "ldap_password" }'

and gets the following error

Trying 10.30.16.72...

TCP_NODELAY set

Connected to gittest.mydomain.com (10.30.16.72) port 80 (#0)

POST /oauth/token HTTP/1.1

Host: gittest.mydomain.com

User-Agent: curl/7.58.0

Accept: /

content-type: application/json

Content-Length: 78

upload completely sent off: 78 out of 78 bytes

HTTP/1.1 401 Unauthorized

Server: nginx

Date: Wed, 13 Nov 2019 12:19:26 GMT

Content-Type: application/json; charset=utf-8

Content-Length: 213

Connection: keep-alive

Cache-Control: no-store

Pragma: no-cache

Www-Authenticate: Bearer realm="Doorkeeper", error="invalid_grant", error_description="The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."

X-Request-Id: XTrOczrDCn2

X-Runtime: 0.145074

Connection #0 to host gittest.mydomain.com left intact

{"error":"invalid_grant","error_description":"The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}

He tried to run it on identical server with no https and it works, I tried to disable https on this server but we got the sane error. There is nothing in the logs I could find.

What might be the cause?

Edited by brancott