Invalid OAuth Client Credentials error when setting up BitBucket Autoscaler for BitBucket Pipelines

Alec Applegate
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 30, 2024

As the topic says, I'm getting the following OAuth error when deploying the runner-controller:

```

self._client.parse_request_body_response(r.text, scope=self.scope) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 427, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in parse_token_response validate_token_parameters(params) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 448, in validate_token_parameters raise_from_error(params.get('error'), params) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 399, in raise_from_error raise cls(**kwargs) oauthlib.oauth2.rfc6749.errors.UnauthorizedClientError: (unauthorized_client) Invalid OAuth client credentials

```

What I've done so far:

1. Created OAuth Consumer for my workspace.

2. Gave the Consumer account:read, runner:write, repository:read permissions.

3. Gave the Consumer a dummy callback URL e.g. `http://localhost:8080`

4. Made the Consumer private

5. Copied the Client ID and Secret from the newly created consumer

6. Ran `echo <CLIENT_ID> | base64` and `echo <SECRET> | base64`

7. Copied the resulting encrypted strings and put them in the kustomization.yaml file, replacing the "" under bitbucketOauthClientId and bitbucketOauthClientSecret so that the file now reads e.g. `value: <MY_BASE64_STRING>`

8. Uncommented Option 1 for both the secret and deployment

9. Ran `kubectl apply -k values`

10. No errors during deployment, but the runner-controller pod is stuck in crash loop with the error from above.

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 31, 2024

Hello @Alec Applegate ,

and welcome to the Community!

The reported error is usually related with the OAuth Consumer ID/Secret not being configured correctly or lacking the required level of permissions.

I would suggest, for testing porpoises, creating a new OAuth consumer with full permissions set, and ensure to look for any leading/trailing space when converting those to base64.

Then, you can configure your kustomization.yaml file again with these new values and try a new deployment.

Would you be able to run that test and let us know how it goes?

Thank you, @Alec Applegate !

Patrik S

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events