Skip to content

Commit 12f3f15

Browse files
committed
feat(cloud-functions): add realtime and callable functions token typing
1 parent cce55b5 commit 12f3f15

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/v1/cloud-functions.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ export interface EventContext<Params = Record<string, string>> {
104104
* does not exist.
105105
*/
106106
auth?: {
107-
token: object;
108107
uid: string;
109-
};
108+
token: EventContextAuthToken;
109+
}
110110

111111
/**
112112
* The level of permissions for a user.
@@ -207,6 +207,26 @@ export interface EventContext<Params = Record<string, string>> {
207207
timestamp: string;
208208
}
209209

210+
export interface EventContextAuthToken {
211+
iss: string;
212+
aud: string;
213+
auth_time: number;
214+
iat: number;
215+
exp: number;
216+
sub: string;
217+
email?: string;
218+
email_verified?: boolean;
219+
phone_number?: string;
220+
name?: string;
221+
firebase?: {
222+
identities?: {
223+
[key: string]: string[];
224+
};
225+
sign_in_provider?: string;
226+
tenant?: string;
227+
};
228+
}
229+
210230
/**
211231
* Resource is a standard format for defining a resource
212232
* (google.rpc.context.AttributeContext.Resource). In Cloud Functions, it is the

0 commit comments

Comments
 (0)