Skip to content

Commit e3f9772

Browse files
authored
feat(cloud-functions): add realtime and callable functions token typing (#1683)
1 parent 461fa11 commit e3f9772

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/v1/cloud-functions.ts

+24-1
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ export interface EventContext<Params = Record<string, string>> {
104104
* does not exist.
105105
*/
106106
auth?: {
107-
token: object;
108107
uid: string;
108+
token: EventContextAuthToken;
109109
};
110110

111111
/**
@@ -207,6 +207,29 @@ export interface EventContext<Params = Record<string, string>> {
207207
timestamp: string;
208208
}
209209

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

0 commit comments

Comments
 (0)