Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving oAuth token fails every time on first call #8914

Closed
yarivlifchuk opened this issue Jun 28, 2020 · 11 comments
Closed

Retrieving oAuth token fails every time on first call #8914

yarivlifchuk opened this issue Jun 28, 2020 · 11 comments
Assignees
Labels
area/security Issues or PRs related to security area/service-mesh Issues or PRs related to service-mesh kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test.

Comments

@yarivlifchuk
Copy link

Description
Kyma version 1.11.1

When calling the following curl to retrieve token there is a failure response and only in the 2nd call it succeed with new token.

curl -X POST -u {ClientId}:{ClientSecret} -d "grant_type=client_credentials&scope=application:read" https://oauth2.{domain}/token -H "Accept: application/json" -H "Accept-Language: en_US"

1st failed response
error":"invalid_client","error_description":"Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authenticatio n method)","status_code":401}

2nd response
300{"access_token":"hbhwWJDunwBFlEAWJjHiqK3CvrICJ8dt7g-VMGI7TmI.yHg41WlnOOPzzm64cmscope":"application:read","token_type":"bearer"}

Expected result

Get success response on first shot.
300{"access_token":"hbhwWJDunwBFlEAWJjHiqK3CvrICJ8dt7g-VMGI7TmI.yHg41WlnOOPzzm64cmscope":"application:read","token_type":"bearer"}

Actual result
a failure response in the 1st attempt and only in the 2nd call it succeed with new token.

1st failed response
error":"invalid_client","error_description":"Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authenticatio n method)","status_code":401}

2nd response
300{"access_token":"hbhwWJDunwBFlEAWJjHiqK3CvrICJ8dt7g-VMGI7TmI.yHg41WlnOOPzzm64cmscope":"application:read","token_type":"bearer"}

Steps to reproduce
Call the following URL (replace clientId,clientSecret and Kyma domain)

curl -X POST -u {ClientId}:{ClientSecret} -d "grant_type=client_credentials&scope=application:read" https://oauth2.{domain}/token -H "Accept: application/json" -H "Accept-Language: en_US"

Troubleshooting
Calling it several times until succeed response

@jakkab jakkab added area/security Issues or PRs related to security kind/bug Categorizes issue or PR as related to a bug. area/service-mesh Issues or PRs related to service-mesh labels Jul 1, 2020
@jakkab jakkab added this to the 1.15 milestone Jul 1, 2020
@piotrmsc piotrmsc assigned jakkab and unassigned piotrmsc Jul 20, 2020
@piotrmsc
Copy link

@jakkab please provide more details here what happened, why we have updated version etc and close it ;)

@jakkab
Copy link
Contributor

jakkab commented Jul 20, 2020

Please refer to ory/hydra#1599. It looks like switching the db driver from lib/pq to jackc/pgx in Hydra solves the problem. Moreover, we might want to set max_conn_lifetime=10s in the DSN should the issue persist (see https://community.ory.sh/t/hydra-broken-pipe/1691).

For now, Hydra has been bumped to v1.4.6 (#9016). This version features updated drivers.
We should also synchronise our ORY chart with ory/k8s repo as described here: #9020

@jakkab jakkab closed this as completed Jul 20, 2020
@colunira
Copy link
Contributor

The issue persists, we need to investigate further.

@colunira colunira reopened this Aug 13, 2020
@piotrmsc piotrmsc modified the milestones: 1.15, 1.17 Aug 26, 2020
@jakkab
Copy link
Contributor

jakkab commented Sep 23, 2020

@yarivlifchuk #9317 should stabilize the connection. Feel free to reopen in case the issue persists.

@jakkab jakkab closed this as completed Sep 23, 2020
@yarivlifchuk
Copy link
Author

Thanks

@tgorgol
Copy link
Contributor

tgorgol commented Oct 2, 2020

This issue started appearing again, some example logs from this week:
LOG 1
LOG 2
LOG 3
LOG 4

@tgorgol tgorgol reopened this Oct 2, 2020
@tgorgol tgorgol added the kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. label Oct 2, 2020
@Tomasz-Smelcerz-SAP
Copy link
Member

Happened again: kyma-integration-gardener-aws

@pbochynski pbochynski removed this from the 1.17 milestone Dec 8, 2020
@kubadz kubadz assigned strekm and unassigned jakkab Jan 13, 2021
@Tomasz-Smelcerz-SAP
Copy link
Member

See also: #10965

@kyma-stale-bot
Copy link

This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. Thank you for your contributions.

@kyma-stale-bot
Copy link

This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. Thank you for your contributions.

@kyma-stale-bot kyma-stale-bot bot added the stale label Aug 22, 2021
@piotrkpc piotrkpc removed the stale label Aug 25, 2021
@pbochynski
Copy link
Contributor

The test is replaced by fast-integration tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security Issues or PRs related to security area/service-mesh Issues or PRs related to service-mesh kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test.
Projects
None yet
Development

No branches or pull requests

10 participants