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

Missing code challenge #13

Open
CubicrootXYZ opened this issue Sep 11, 2021 · 3 comments
Open

Missing code challenge #13

CubicrootXYZ opened this issue Sep 11, 2021 · 3 comments

Comments

@CubicrootXYZ
Copy link

As far as I can see there is no code challenge available in this package altough go-oauth2/oauth2 provides it.

Can someone explain me how to use it inside this package or provide a statement if this feature will be added in future?

Thanks in advance.

@jarlandre
Copy link

this has to be deprecated .. gin-server piggy backs on go-oauth2/oauth2 and i currently use the latest version of the latter in conjunction with gin-server

@jarlandre
Copy link

jarlandre commented Jan 18, 2023

its definitely working. Just tested with postman

Screenshot 2023-01-18 at 15 16 21

plus code for token validation does this

func (m *Manager) validateCodeChallenge(ti oauth2.TokenInfo, ver string) error {
	cc := ti.GetCodeChallenge()
	// early return
	if cc == "" && ver == "" {
		return nil
	}
	if cc == "" {
		return errors.ErrMissingCodeVerifier
	}
	if ver == "" {
		return errors.ErrMissingCodeVerifier
	}
	ccm := ti.GetCodeChallengeMethod()
	if ccm.String() == "" {
		ccm = oauth2.CodeChallengePlain
	}
	if !ccm.Validate(cc, ver) {
		return errors.ErrInvalidCodeChallenge
	}
	return nil
}

@jarlandre
Copy link

however, it only works if you send the client_secret with the token request. Which shouldnt be required for mobile apps for ex

added PR in oauth2 go-oauth2/oauth2#230

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

No branches or pull requests

2 participants