Skip to content

Feat: Allow adding custom values to session #611

Open
@g3ano

Description

@g3ano

I ran into a situation where I needed to retain a small state between the oauth initialization and callback step

the package currently exposes a StoreInSession function to write key/value to the session. The issue is that it commits the session to the request after setting that value, so any other calls to the function will overrides the previous values

to work around this, I ended up creating a separate short-lived session (alongside the gothic session) that lives only during the oauth flow, it works but it adds unnecessary complexity for just storing a couple of values temporarily

I think its fine to have separate session to manage long-lived states, but for use cases like mine, it would be more efficient to have a way to write multiple values at once

something like:

// current
StoreInSession(key string, value string, req *http.Request, res http.ResponseWriter)

// suggested
StoreInSessionValues(values map[string]string, req *http.Request, res http.ResponseWriter)

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