oauth2
oauth2 copied to clipboard
Do you have a working example of all the authentication method?
I am trying to implement all the OAuth2 authentication methods under the same program, but I am having an issue by just adding the Client Credential
method to the example/server.go
. When adding these two lines from your example in the readme
to the example/server.go
, the Authorization Code
flow doesn't work anymore.
srv.SetAllowGetAccessRequest(true)
srv.SetClientInfoHandler(server.ClientFormHandler)
And if I remove the 2 lines Authorization Code
is working again but Client Credentials
fails of course.
srv.SetUserAuthorizationHandler(userAuthorizeHandler)
//srv.SetAllowGetAccessRequest(true)
//srv.SetClientInfoHandler(server.ClientFormHandler)
So, either the Client Credential
flow works, either the Authorization Code
flow.
Can you advise on what is going on?
I think it would be great if you had a working server example with all the authentication method working together, this would make this open source oauth2 package far ahead from the other ones.
Thank you!
I added an example of the use of password mode and client mode, you can check it out:https://github.com/go-oauth2/oauth2/tree/master/example
@LyricTian Wow, that's awesome! This really changes the game thanks! I understand now at a glance how this implemetation of OAuth is built. I am impressed about how clean this is and how minimum work is required to implement a server 👍
Do you have a working example using gorm ? i tried to combine example using buntDB and example in mysql but i've always get message Response Error: unsupported_grant_type
I added an example of the use of password mode and client mode, you can check it out:https://github.com/go-oauth2/oauth2/tree/master/example
def not working with code flow