File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,14 +2,21 @@ import { getOwner } from '@ember/owner';
22
33import BaseAuthenticator from 'ember-simple-auth/authenticators/base' ;
44
5+ import type { Session , User } from '@supabase/supabase-js' ;
6+
57import type SupabaseService from '../services/supabase.ts' ;
68
9+ /**
10+ * Authentication data structure for ember-simple-auth.
11+ * This is a simplified version of Supabase's Session and User data
12+ * that ember-simple-auth will persist and restore.
13+ */
714export interface SupabaseAuthData {
8- userId : string ;
9- email : string ;
10- accessToken : string ;
11- refreshToken : string ;
12- expiresAt : number ;
15+ userId : User [ 'id' ] ;
16+ email : User [ 'email' ] ;
17+ accessToken : Session [ 'access_token' ] ;
18+ refreshToken : Session [ 'refresh_token' ] ;
19+ expiresAt : Session [ 'expires_at' ] ;
1320}
1421
1522export interface OtpCredentials {
Original file line number Diff line number Diff line change @@ -2,19 +2,14 @@ import { service } from '@ember/service';
22
33import BaseSessionService from 'ember-simple-auth/services/session' ;
44
5+ import type { SupabaseAuthData } from '../authenticators/supabase.ts' ;
56import type DataService from './data.ts' ;
67
7- interface SupabaseAuthData {
8- authenticated : {
9- userId : string ;
10- email : string ;
11- accessToken : string ;
12- refreshToken : string ;
13- expiresAt : number ;
14- } ;
8+ interface SessionData {
9+ authenticated : SupabaseAuthData ;
1510}
1611
17- export default class SessionService extends BaseSessionService < SupabaseAuthData > {
12+ export default class SessionService extends BaseSessionService < SessionData > {
1813 @service ( 'data' ) declare swachData : DataService ;
1914
2015 handleAuthentication ( routeAfterAuthentication : string ) {
You can’t perform that action at this time.
0 commit comments