go-oauth2 / oauth2

OAuth 2.0 server library for the Go programming language.
https://pkg.go.dev/github.com/go-oauth2/oauth2/v4
MIT License
3.31k stars 563 forks source link

How to add a custom grant type, such as email + verification code #212

Open bingfenglai opened 2 years ago

bingfenglai commented 2 years ago

How to add a custom grant type, such as email + verification code.

jarlandre commented 1 year ago

when you say "grant type", do you mean "grant_type" which is passed into the token endpoint? If so, then i would use SetPasswordAuthorizationHandler on the server. And use the password grant_type. Just send in username with email and password with token. Done. Fixed it. Of course this server that receives this password grant call would need access to the db where the code is stored for comparison of course. there is no open standard for custom grant types AFAIK.

Inasayang commented 1 year ago

Oauth2 is used for authorization, not authentication.