Implement register and login with Telegram
Add the concept of authentication methods that authenticate an account where using the telegram login widget is one such method. If a login is done with an authentication method that's not associated with any account the session ends up with the data from the authentication method in order to allow registering a new account with the authentication method. This has to be stored on the session as otherwise it wouldn't be possible to implement authentication methods such as OAuth2 that takes the user to a third-party site and then redirects the browser back.
This commit is contained in:
parent
2d6bcebc5a
commit
aaa2faffb1
14 changed files with 357 additions and 8 deletions
|
@ -26,6 +26,8 @@ const fetchSessionWithCookie = async (event?: H3Event) => {
|
|||
export const useSessionStore = defineStore("session", () => {
|
||||
const state = {
|
||||
account: ref<ApiAccount>(),
|
||||
authenticationProvider: ref<string>(),
|
||||
authenticationName: ref<string>(),
|
||||
id: ref<number>(),
|
||||
push: ref<boolean>(false),
|
||||
};
|
||||
|
@ -37,6 +39,8 @@ export const useSessionStore = defineStore("session", () => {
|
|||
},
|
||||
update(session?: ApiSession) {
|
||||
state.account.value = session?.account;
|
||||
state.authenticationProvider.value = session?.authenticationProvider;
|
||||
state.authenticationName.value = session?.authenticationName;
|
||||
state.id.value = session?.id;
|
||||
state.push.value = session?.push ?? false;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue