Skip to content

Latest commit

 

History

History
485 lines (303 loc) · 12 KB

SessionAPI.md

File metadata and controls

485 lines (303 loc) · 12 KB

\SessionAPI

All URIs are relative to https://subdomain.okta.com

Method HTTP request Description
CloseCurrentSession Delete /api/v1/sessions/me Close the current Session
CreateSession Post /api/v1/sessions Create a Session with session token
GetCurrentSession Get /api/v1/sessions/me Retrieve the current Session
GetSession Get /api/v1/sessions/{sessionId} Retrieve a Session
RefreshCurrentSession Post /api/v1/sessions/me/lifecycle/refresh Refresh the current Session
RefreshSession Post /api/v1/sessions/{sessionId}/lifecycle/refresh Refresh a Session
RevokeSession Delete /api/v1/sessions/{sessionId} Revoke a Session

CloseCurrentSession

CloseCurrentSession(ctx).Cookie(cookie).Execute()

Close the current Session

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    cookie := "sid=abcde-123 or idx=abcde-123" // string |  (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    r, err := apiClient.SessionAPI.CloseCurrentSession(context.Background()).Cookie(cookie).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `SessionAPI.CloseCurrentSession``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiCloseCurrentSessionRequest struct via the builder pattern

Name Type Description Notes
cookie string

Return type

(empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateSession

Session CreateSession(ctx).CreateSessionRequest(createSessionRequest).Execute()

Create a Session with session token

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    createSessionRequest := *openapiclient.NewCreateSessionRequest() // CreateSessionRequest | 

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.SessionAPI.CreateSession(context.Background()).CreateSessionRequest(createSessionRequest).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `SessionAPI.CreateSession``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateSession`: Session
    fmt.Fprintf(os.Stdout, "Response from `SessionAPI.CreateSession`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiCreateSessionRequest struct via the builder pattern

Name Type Description Notes
createSessionRequest CreateSessionRequest

Return type

Session

Authorization

apiToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetCurrentSession

Session GetCurrentSession(ctx).Cookie(cookie).Execute()

Retrieve the current Session

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    cookie := "sid=abcde-123 or idx=abcde-123" // string |  (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.SessionAPI.GetCurrentSession(context.Background()).Cookie(cookie).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `SessionAPI.GetCurrentSession``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetCurrentSession`: Session
    fmt.Fprintf(os.Stdout, "Response from `SessionAPI.GetCurrentSession`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetCurrentSessionRequest struct via the builder pattern

Name Type Description Notes
cookie string

Return type

Session

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSession

Session GetSession(ctx, sessionId).Execute()

Retrieve a Session

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    sessionId := "l7FbDVqS8zHSy65uJD85" // string | `id` of the Session

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.SessionAPI.GetSession(context.Background(), sessionId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `SessionAPI.GetSession``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetSession`: Session
    fmt.Fprintf(os.Stdout, "Response from `SessionAPI.GetSession`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
sessionId string `id` of the Session

Other Parameters

Other parameters are passed through a pointer to a apiGetSessionRequest struct via the builder pattern

Name Type Description Notes

Return type

Session

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RefreshCurrentSession

Session RefreshCurrentSession(ctx).Cookie(cookie).Execute()

Refresh the current Session

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    cookie := "sid=abcde-123 or idx=abcde-123" // string |  (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.SessionAPI.RefreshCurrentSession(context.Background()).Cookie(cookie).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `SessionAPI.RefreshCurrentSession``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `RefreshCurrentSession`: Session
    fmt.Fprintf(os.Stdout, "Response from `SessionAPI.RefreshCurrentSession`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiRefreshCurrentSessionRequest struct via the builder pattern

Name Type Description Notes
cookie string

Return type

Session

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RefreshSession

Session RefreshSession(ctx, sessionId).Execute()

Refresh a Session

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    sessionId := "l7FbDVqS8zHSy65uJD85" // string | `id` of the Session

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.SessionAPI.RefreshSession(context.Background(), sessionId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `SessionAPI.RefreshSession``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `RefreshSession`: Session
    fmt.Fprintf(os.Stdout, "Response from `SessionAPI.RefreshSession`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
sessionId string `id` of the Session

Other Parameters

Other parameters are passed through a pointer to a apiRefreshSessionRequest struct via the builder pattern

Name Type Description Notes

Return type

Session

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RevokeSession

RevokeSession(ctx, sessionId).Execute()

Revoke a Session

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    sessionId := "l7FbDVqS8zHSy65uJD85" // string | `id` of the Session

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    r, err := apiClient.SessionAPI.RevokeSession(context.Background(), sessionId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `SessionAPI.RevokeSession``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
sessionId string `id` of the Session

Other Parameters

Other parameters are passed through a pointer to a apiRevokeSessionRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]