-
-
Notifications
You must be signed in to change notification settings - Fork 189
Description
Describe the feature
First of all, my English is not good and I think we can work more flexibly if an update comes so that the getSession method can be used in this way.
Some rest api's is not well designed for frontend developers. Here is a scenario:
I have 2 endpoints for getting a bearer token and these endpoints are accept only "POST" method.
First endpoint is '/oauth/token' getting Email, Password, GrantType, Scope, ClientId, ClientSecret, RedirectUri fields in posted data and this endpoint returns AccessToken, RefreshToken, ExpiresAt, TokenType
Second endpoint is '/user/user-information' this endpoint accessible with Email field inside posted data and Authorization Bearer token.
When I look the Sidebase/Nuxt-Auth documentation I see for getting user data to use this method: getSession, I will use this method after send the signIn event but the getSession method don't accept the custom request body. For example:
<script setup lang="ts">
const config = useRuntimeConfig()
const {$toast} = useNuxtApp();
const Email = ref('');
const Password = ref('');
const login = async() => {
try {
await signIn({
Email.value,
Password.value,
config.GrantType,
config.Scope,
config.ClientId,
config.ClientSecret,
config.RedirectUri
},{ redirect: false })
await getSession('/user/user-information', // This variable maybe passed for setting user info endpoint
{
Email: Email.value // This variable maybe passed in here as a request body this method for getting user info after successfully login.
})
$toast.success("Loggedin Successfully!");
} catch(e){
console.log(e)
}
}
</script>
And If I set the getSession inside nuxt.config.ts endpoints object to false, the getSession running automatically sends wrong endpoint continuously. Maybe its is a bug actually.
How would you implement this?
getSession('endpoint', request.body.object, ...other params)
Additional information
- Would you be willing to help implement this feature?
Provider
- AuthJS
- Local
- Refresh
- New Provider