Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add /revoke endpoint to invalidate a token #2

Open
daschaa opened this issue Dec 21, 2024 · 0 comments
Open

add /revoke endpoint to invalidate a token #2

daschaa opened this issue Dec 21, 2024 · 0 comments

Comments

@daschaa
Copy link
Owner

daschaa commented Dec 21, 2024

Description
The revoke endpoint should invalidate a valid access token.

func revokeHandler(w http.ResponseWriter, r *http.Request) {
    r.ParseForm()
    token := r.FormValue("token")

    // Revoke token logic (in-memory example)
    if token == "valid-access-token" {
        // Revoke the token (e.g., remove it from a database or cache)
        fmt.Println("Token revoked:", token)
    }

    // Respond with success (even if token was invalid, for security reasons)
    w.WriteHeader(http.StatusOK)
}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant