1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-04-14 13:01:54 +02:00

added meta.isNew to the json OAuth2 auth response

This commit is contained in:
Gani Georgiev 2023-05-18 00:19:36 +03:00
parent d36a044dc7
commit 6d0303deaf
2 changed files with 11 additions and 1 deletions

View File

@ -45,6 +45,8 @@
- Added support for multiple relations sort in the Admin UI.
- Added `meta.isNew` to the OAuth2 auth JSON response to indicate newly created PocketBase user.
## v0.15.3

View File

@ -242,7 +242,15 @@ func (api *recordAuthApi) authWithOAuth2(c echo.Context) error {
e.Record = data.Record
e.OAuth2User = data.OAuth2User
return RecordAuthResponse(api.app, e.HttpContext, e.Record, e.OAuth2User)
meta := struct {
*auth.AuthUser
IsNew bool `json:"isNew"`
}{
AuthUser: e.OAuth2User,
IsNew: event.IsNewRecord,
}
return RecordAuthResponse(api.app, e.HttpContext, e.Record, meta)
})
}
})