Skip to content

Commit c72fb7e

Browse files
Merge pull request #231 from supertokens/feat/header-based-auth
feat: add support for header based auth
2 parents 4e5a8cc + b6c4b72 commit c72fb7e

File tree

81 files changed

+4513
-1117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+4513
-1117
lines changed

CHANGELOG.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,58 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [unreleased]
99

10+
## [0.10.0]
11+
12+
### Fixes
1013
- Fixes issue with go-fiber example, where updating accessTokenPayload from user defined endpoint doesn't reflect in the response cookies.
1114

15+
### Added
16+
- Added support for authorizing requests using the `Authorization` header instead of cookies
17+
- Optional `GetTokenTransferMethod` config is Session recipe input, which determines the token transfer method.
18+
- Check out https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/sessions/token-transfer-method for more information
19+
20+
### Removed
21+
- ID Refresh token is removed from the SDK
22+
23+
### Breaking changes
24+
- The frontend SDK should be updated to a version supporting the header-based sessions!
25+
- supertokens-auth-react: >= 0.32.0
26+
- supertokens-web-js: >= 0.5.0
27+
- supertokens-website: >= 16.0.0
28+
- supertokens-react-native: >= 4.0.0
29+
- `CreateNewSession` now requires passing the request as well as the response.
30+
- This only requires a change if you manually created sessions (e.g.: during testing)
31+
- Check the migration example below
32+
- `CreateNewSessionWithContext` and `CreateNewSession` in the session recipe accepts new
33+
- Only supporting FDI 1.16
34+
parameter `req` of type `*http.Request`
35+
36+
### Migration
37+
38+
Before:
39+
40+
```go
41+
func httpHandler(w http.ResponseWriter, r *http.Request,) {
42+
sessionContainer, err := session.CreateNewSession(w, "userId", map[string]interface{}{}, map[string]interface{}{})
43+
if err != nil {
44+
// handle error
45+
}
46+
// ...
47+
}
48+
```
49+
50+
After:
51+
52+
```go
53+
func httpHandler(w http.ResponseWriter, r *http.Request,) {
54+
sessionContainer, err := session.CreateNewSession(r, w, "userId", map[string]interface{}{}, map[string]interface{}{})
55+
if err != nil {
56+
// handle error
57+
}
58+
// ...
59+
}
60+
```
61+
1262
## [0.9.14] - 2022-12-26
1363

1464
- Fixes an issue in the dashboard recipe when fetching user details for passwordless users that don't have an email associated with their accounts
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"_comment": "contains a list of frontend-driver interfaces branch names that this core supports",
33
"versions": [
4-
"1.15"
4+
"1.16"
55
]
66
}

recipe/emailpassword/api/implementation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func MakeAPIImplementation() epmodels.APIInterface {
145145
}
146146

147147
user := response.OK.User
148-
session, err := session.CreateNewSessionWithContext(options.Res, user.ID, map[string]interface{}{}, map[string]interface{}{}, userContext)
148+
session, err := session.CreateNewSessionWithContext(options.Req, options.Res, user.ID, map[string]interface{}{}, map[string]interface{}{}, userContext)
149149
if err != nil {
150150
return epmodels.SignInPOSTResponse{}, err
151151
}
@@ -184,7 +184,7 @@ func MakeAPIImplementation() epmodels.APIInterface {
184184

185185
user := response.OK.User
186186

187-
session, err := session.CreateNewSessionWithContext(options.Res, user.ID, map[string]interface{}{}, map[string]interface{}{}, userContext)
187+
session, err := session.CreateNewSessionWithContext(options.Req, options.Res, user.ID, map[string]interface{}{}, map[string]interface{}{}, userContext)
188188
if err != nil {
189189
return epmodels.SignUpPOSTResponse{}, err
190190
}

0 commit comments

Comments
 (0)