Skip to content

add /revoke endpoint to invalidate a token #2

@daschaa

Description

@daschaa

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)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions