Redirect URL not working for GitHub provider
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.6k
- Forks
- 631
- PR merge metrics
- No merged PRs in 30d
Description
Hi there,
I'm trying to get GitHub authentication working at the moment, but I'm running into an issue where the provider is seemingly not setting the `redirect_uri` query parameter when redirecting to GitHub's `authorize` endpoint. I think I am configuring it correctly and I double-checked that my redirect URL is set to localhost, but I still get redirected to the prod domain.
```go
var (
ghClientId = os.Getenv("OAUTH_GITHUB_CLIENT_ID")
ghClientSecret = os.Getenv("OAUTH_GITHUB_CLIENT_SECRET")
ghRedirectUrl = os.Getenv("OAUTH_GITHUB_REDIRECT_URL")
)
func main() {
// ...
goth.UseProviders(
github.New(ghClientId, ghClientSecret, ghRedirectUrl, "email"),
)
// ...
}
```
When I check the redirects in my browser's developer tools it's visible that the `redirect_uri` parameter is missing entirely.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the GitHub provider configured through github.New and trace how its authorization URL is built. Reproduce the redirect with browser developer tools, then verify that the configured localhost URL is included as the redirect_uri parameter in the GitHub authorize request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100