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

OAuth2 Token Revoke call results in 404 Not Found #1070

Closed
slax0rr opened this issue Oct 4, 2018 · 3 comments
Closed

OAuth2 Token Revoke call results in 404 Not Found #1070

slax0rr opened this issue Oct 4, 2018 · 3 comments
Assignees
Labels
bug Something is not working. package/sdk
Milestone

Comments

@slax0rr
Copy link

slax0rr commented Oct 4, 2018

I believe I have encountered a bug in the OAuth2Api.RevokeOAuth2Token function in the Go SDK. With both the AdminURL and the PublicURL along with client credentials set in the Configuration, the OAuth2Api struct holds the AdminURL as its Configuration.BasePath value, and a call to the RevokeOAuth2Token then triggers a request to the AdminURL + "/oauth2/token" URL, which results in a 404 Not Found error. I have tried manually overriding the localVarPath in the RevokeOAuth2Token method to use the PublicURL as the BasePath and the request then works normally, and the token is revoked successfully.

Short example:

sdk, _ := hydra.NewSDK(&hydra.Configuration{
    AdminURL: "https://hydra:4445",
    PublicURL: "https://hydra:4444",
    ClientID: "some-client",
    ClientSecret: "some-secret",
}

sdk.RevokeOAuth2Token("some-token value")

Expected behaviour is for the above revoke call to succeed, but the response status code is 404 instead.

Tested in 1.0.0-beta.9

@aeneasr
Copy link
Member

aeneasr commented Oct 5, 2018

Yeah, that's a bug. Feel free to PR!

@aeneasr
Copy link
Member

aeneasr commented Oct 5, 2018

I think the best way to solve is is what @fredbi set on discord: Introduce "admin" and "public" tags to the swagger conf and thus separating the implementations.

@aeneasr aeneasr added bug Something is not working. package/sdk labels Oct 5, 2018
@aeneasr aeneasr added this to the v1.0.0-rc.1 milestone Oct 5, 2018
@aeneasr aeneasr self-assigned this Oct 5, 2018
@slax0rr
Copy link
Author

slax0rr commented Oct 6, 2018

I do not have enough in-depth knowledge in your SDK yet, but I guess I would simply add the PublicPath to the configuration, with a new NewOAuth2Api method that would accept either a whole Configuration instance or both BasePath and PublicPath, and then let each func decide which path to use for the call.

Edit: if this would be acceptable, I can prepare a PR.

aeneasr added a commit that referenced this issue Nov 8, 2018
Closes #1070

Signed-off-by: aeneasr <aeneas@ory.sh>
@aeneasr aeneasr closed this as completed in 89f5960 Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working. package/sdk
Projects
None yet
Development

No branches or pull requests

2 participants