mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: major login and signup changes
This commit is contained in:
parent
5ca1ba75e1
commit
2ae8dbeba5
20 changed files with 217 additions and 141 deletions
|
|
@ -8,7 +8,6 @@ import { LEARNHOUSE_TOP_DOMAIN, getUriWithOrg } from '@services/config/config'
|
|||
import { getResponseMetadata } from '@services/utils/ts/requests'
|
||||
import CredentialsProvider from 'next-auth/providers/credentials'
|
||||
import GoogleProvider from 'next-auth/providers/google'
|
||||
import { cookiesOptions } from './cookies'
|
||||
|
||||
const isDevEnv = LEARNHOUSE_TOP_DOMAIN == 'localhost' ? true : false
|
||||
|
||||
|
|
@ -82,24 +81,24 @@ export const nextAuthOptions = {
|
|||
token.user = userFromOAuth.data
|
||||
}
|
||||
|
||||
// Refresh token
|
||||
// TODO : Improve this implementation
|
||||
if (token?.user?.tokens) {
|
||||
const RefreshedToken = await getNewAccessTokenUsingRefreshTokenServer(
|
||||
token?.user?.tokens?.refresh_token
|
||||
)
|
||||
token = {
|
||||
...token,
|
||||
user: {
|
||||
...token.user,
|
||||
tokens: {
|
||||
...token.user.tokens,
|
||||
access_token: RefreshedToken.access_token,
|
||||
// Refresh token
|
||||
// TODO : Improve this implementation
|
||||
if (token?.user?.tokens) {
|
||||
const RefreshedToken = await getNewAccessTokenUsingRefreshTokenServer(
|
||||
token?.user?.tokens?.refresh_token
|
||||
)
|
||||
token = {
|
||||
...token,
|
||||
user: {
|
||||
...token.user,
|
||||
tokens: {
|
||||
...token.user.tokens,
|
||||
access_token: RefreshedToken.access_token,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
return token
|
||||
return token
|
||||
},
|
||||
async session({ session, token }: any) {
|
||||
// Include user information in the session
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue