AuthN | Go SDK | Session Endpoints
Session Endpoints
Invalidate Session | Client
func (a *ClientSession) Invalidate(ctx context.Context, input ClientSessionInvalidateRequest) (*pangea.PangeaResponse[ClientSessionInvalidateResult], error)Invalidate a session by session ID using a client token.
input := authn.ClientSessionInvalidateRequest{
Token: "ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
SessionID: "pmt_zppkzrjguxyblaia6itbiesejn7jejnr",
}
resp, err := authncli.Client.Session.Invalidate(ctx, input)
List sessions (client token)
func (a *ClientSession) List(ctx context.Context, input ClientSessionListRequest) (*pangea.PangeaResponse[SessionListResult], error)List sessions using a client token.
input := authn.ClientSessionListRequest{
Token: "ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
}
resp, err := authncli.Client.Session.List(ctx, input)
Log out (client token)
func (a *ClientSession) Logout(ctx context.Context, input ClientSessionLogoutRequest) (*pangea.PangeaResponse[ClientSessionLogoutResult], error)Log out the current user's session.
input := authn.ClientSessionLogoutRequest{
Token: "ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
}
resp, err := authncli.Client.Session.Logout(ctx, input)
Refresh a Session
func (a *ClientSession) Refresh(ctx context.Context, input ClientSessionRefreshRequest) (*pangea.PangeaResponse[ClientSessionRefreshResult], error)Refresh a session token.
input := authn.ClientSessionRefreshRequest{
RefreshToken: "ptr_xpkhwpnz2cmegsws737xbsqnmnuwtbm5",
UserToken: "ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
}
resp, err := authncli.Client.Session.Refresh(ctx, input)
Invalidate Session
func (a *Session) Invalidate(ctx context.Context, input SessionInvalidateRequest) (*pangea.PangeaResponse[SessionInvalidateResult], error)Invalidate a session by session ID.
input := authn.SessionInvalidateRequest{
SessionID: "pmt_zppkzrjguxyblaia6itbiesejn7jejnr",
}
resp, err := authncli.Session.Invalidate(ctx, input)
List session (service token)
func (a *Session) List(ctx context.Context, input SessionListRequest) (*pangea.PangeaResponse[SessionListResult], error)List sessions.
input := authn.SessionListRequest{}
resp, err := authn.Session.List(ctx, input)
Log out (service token)
func (a *Session) Logout(ctx context.Context, input SessionLogoutRequest) (*pangea.PangeaResponse[SessionLogoutResult], error)Invalidate all sessions belonging to a user.
input := authn.SessionLogoutRequest{
UserID: "pui_xpkhwpnz2cmegsws737xbsqnmnuwtvm5",
}
resp, err := authncli.Session.Logout(ctx, input)
Type ClientSessionInvalidateRequest
type ClientSessionInvalidateRequest structtype ClientSessionInvalidateRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
Token string `json:"token"`
SessionID string `json:"session_id"`
}
Type ClientSessionListRequest
type ClientSessionListRequest structtype ClientSessionListRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
Token string `json:"token"`
// Should use FilterSessionList object here
Filter pangea.Filter `json:"filter,omitempty"`
Last string `json:"last,omitempty"`
Order ItemOrder `json:"order,omitempty"`
OrderBy SessionListOrderBy `json:"order_by,omitempty"`
}
Type ClientSessionLogoutRequest
type ClientSessionLogoutRequest structtype ClientSessionLogoutRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
Token string `json:"token"`
}
Type ClientSessionRefreshRequest
type ClientSessionRefreshRequest structtype ClientSessionRefreshRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
RefreshToken string `json:"refresh_token"`
UserToken string `json:"user_token,omitempty"`
}
Type ItemOrder
type ItemOrder stringtype ItemOrder string
Type SessionInvalidateRequest
type SessionInvalidateRequest structtype SessionInvalidateRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
SessionID string `json:"session_id"`
}
Type SessionListOrderBy
type SessionListOrderBy stringtype SessionListOrderBy string
Type SessionListRequest
type SessionListRequest structtype SessionListRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
// Should use FilterSessionList object here
Filter pangea.Filter `json:"filter,omitempty"`
Last string `json:"last,omitempty"`
Order ItemOrder `json:"order,omitempty"`
OrderBy SessionListOrderBy `json:"order_by,omitempty"`
}
Type SessionLogoutRequest
type SessionLogoutRequest structtype SessionLogoutRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
UserID string `json:"user_id"`
}