mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-02-05 13:59:56 +08:00
commit
00b79eb19d
@ -15,9 +15,9 @@
|
||||
*/
|
||||
import { get } from '@lowdefy/helpers';
|
||||
|
||||
function addUserFieldsToToken(context, { account, authConfig, profile, token }) {
|
||||
function addUserFieldsToToken(context, { account, authConfig, profile, token, user }) {
|
||||
// const { debug } = context.logger;
|
||||
const objects = { account, profile };
|
||||
const objects = { account, profile, user };
|
||||
// TODO: Add when debug is fixed.
|
||||
// debug('Adding userFields to user. Available provider data is:');
|
||||
// debug(objects);
|
||||
|
@ -71,8 +71,11 @@ function createJWTCallback(context, { authConfig, plugins }) {
|
||||
updated_at,
|
||||
...token,
|
||||
};
|
||||
}
|
||||
|
||||
if (profile || user) {
|
||||
if (authConfig.userFields) {
|
||||
addUserFieldsToToken(context, { authConfig, account, profile, token });
|
||||
addUserFieldsToToken(context, { authConfig, account, profile, token, user });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ function getNextAuthConfig(context, { authJson, plugins }) {
|
||||
|
||||
nextAuthConfig.session = authConfig.session;
|
||||
nextAuthConfig.theme = authConfig.theme;
|
||||
nextAuthConfig.cookies = authConfig?.advanced?.cookies;
|
||||
initialized = true;
|
||||
return nextAuthConfig;
|
||||
}
|
||||
|
@ -72,6 +72,14 @@ export default {
|
||||
type: 'App "auth" should be an object.',
|
||||
},
|
||||
properties: {
|
||||
advanced: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
cookies: {
|
||||
type: 'object',
|
||||
},
|
||||
},
|
||||
},
|
||||
callbacks: {
|
||||
type: 'array',
|
||||
items: {
|
||||
|
@ -42,14 +42,14 @@ function getCallbackUrl({ lowdefy, callbackUrl = {} }) {
|
||||
function createAuthMethods({ lowdefy, auth }) {
|
||||
// login and logout are Lowdefy function that handle action params
|
||||
// signIn and signOut are the next-auth methods
|
||||
function login({ authUrl, callbackUrl, providerId } = {}) {
|
||||
function login({ authUrl, callbackUrl, providerId, ...rest } = {}) {
|
||||
if (type.isNone(providerId) && auth.authConfig.providers.length === 1) {
|
||||
providerId = auth.authConfig.providers[0].id;
|
||||
}
|
||||
|
||||
auth.signIn(
|
||||
providerId,
|
||||
{ callbackUrl: getCallbackUrl({ lowdefy, callbackUrl }) },
|
||||
{ ...rest, callbackUrl: getCallbackUrl({ lowdefy, callbackUrl }) },
|
||||
authUrl?.urlQuery
|
||||
);
|
||||
}
|
||||
|
@ -20,7 +20,10 @@
|
||||
```
|
||||
- Add env vars `NEXTAUTH_URL` and `NEXTAUTH_SECRET`.
|
||||
- Add new callback urls to auth0 `{{ protocol }}{{ host }}/api/auth/callback/{{ providerId }}`.
|
||||
- convert login params (`callbackUrl`, `authUrl.urlQuery`)
|
||||
- Convert types to plugins.
|
||||
- Replace `onEnter` and `onEnterAsync` with `onMount` and `onMountAsync`.
|
||||
- Convert old loading on blocks to new loading.
|
||||
- Convert all request operators except `_user`, to use `_payload`.
|
||||
- Convert `Message` action to `DisplayMessage`
|
||||
- Static files are no longer at 'public/...', (our logged out page for example)
|
||||
|
Loading…
Reference in New Issue
Block a user