Skip to content

How to use? #41

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

Closed
Savrov opened this issue Dec 21, 2018 · 6 comments
Closed

How to use? #41

Savrov opened this issue Dec 21, 2018 · 6 comments

Comments

@Savrov
Copy link

Savrov commented Dec 21, 2018

I'm totally new, can you provide some info how to use it in my REST endpoints? I'm using this lib for Ktor

I've installed the feature but how I can access Oauth2TokenService class with /auth endpoint?

@adhesivee
Copy link
Collaborator

@sergiocasero
Copy link

Hello! I'm also a little bit confused. I've configured everything on the app but I don't know how to use it.

When I try to get the token with postman (for example) I just get an empty page, could you please add a "full" sample about how to use it for noobs?

@adhesivee
Copy link
Collaborator

@sergiocasero I think there is quite some information available how to use oauth
Maybe I can include some basic example but I dont know in which format yet

If you POST to token endpoint I think it should always respond with something. This might be a bug, did you see an exceptions showing up in the log?

@sergiocasero
Copy link

sergiocasero commented Jun 26, 2019

Hello, the logs don't say anything (using ktor)

this is my configuration:

install(Oauth2ServerFeature) {
        identityService = InMemoryIdentity()
            .identity {
                username = "test"
                password = "test"
            }

        clientService = InMemoryClient()
            .client {
                clientId = "test"
                clientSecret = "test"
                scopes = setOf("test")
                redirectUris = setOf("http://localhost:8080/callback")
                authorizedGrantTypes = setOf(AuthorizedGrantType.AUTHORIZATION_CODE)
            }

        tokenStore = InMemoryTokenStore()
    }

And this is the postman config:
imagen

And postman says...
imagen

Also, I don't how to encapsulate my requests into the "auth" section. When I use the ktor auth module, I always put the routings inside authentication { } block, but it seems to be not working with the lib-

@adhesivee
Copy link
Collaborator

adhesivee commented Jun 27, 2019

@sergiocasero I tested it with postman. Postman seems to be the problem here. That empty page what you see is the part where you normally login with basic authentication (/oauth/authorize).
It seems you can not use basic auth for authorization endpoints in postman.
With the coming release form logins could be supported. I need to create examples for this too. I will create an issue (#67).

I am not sure what you mean with: I always put the routings inside authentication { } block, but it seems to be not working with the lib
Could you please open a new issue and give some examples what you mean?

@sergiocasero
Copy link

Yes... you was totally right, my bad sorry, the problem is POSTMAN, by making the requests manually looks like it works fine. Thanks for the awesome job! I'll open a new issue with the explanation of "encapsulating requests"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants