Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tyk-docs/content/api-management/plugins/golang.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,13 @@ func MyPluginFunction(w http.ResponseWriter, r *http.Request) {
}
```

{{< note warning >}}
**Note**

Tyk Gateway sets the session in the [Authentication layer]({{< ref "api-management/traffic-transformation#request-middleware-chain" >}}) of the middleware chain. Because of this, the session object does not exist until the middleware chain runs after the authentication middleware. If you call `ctx.GetSession` inside a custom auth plugin, it will always return an empty object.

{{< /note >}}

The invocation of `ctx.GetSession(r)` returns an SessionState object.
The Go data structure can be found [here](https://github.com/TykTechnologies/tyk/blob/master/user/session.go#L106).

Expand Down
Loading