@minhaj Okay, after messing with this for two days, I am still nowhere, although my understanding is someone better.
Here is what I have:
# Dgraph.Authorization {
"VerificationKey":"",
"Header":"X-Firebase-Token",
"Namespace":"",
"jwkUrl": "whatever-client-x509-url-is",
"Algo":"",
"Audience":["my-firebase-project-name"]
}
1.) I went to Firebase Console > Settings > Service accounts > Firebase Admin SDK > Generate new private key
2.) I downloaded the file and copied the client_x509_cert_url into jwkUrl according to the github.
3.) My schema:
type Todo @withSubscription @auth(
query: { rule: """
query($email: String!) {
queryTodo {
user(filter: { username: { eq: $email } }) {
__typename
}
}
}"""}), {
id: ID!
value: String! @search(by: [fulltext])
completed: Boolean! @search
user: User!
}
type User @withSubscription {
username: String! @id @search(by: [hash])
name: String @search(by: [exact])
todos: [Todo] @hasInverse(field: user)
}
You do not need to generate a function in firebase, as you can do this on the frontend with Angular / React by running some form of user.getIdToken(). This includes the userId and email by default, however there is NO namespace. The token looks something like this:
{
"name": "Jonathan Gamble",
"picture": "https://lh3.googleusercontent.com/a-/..."
"iss": "https://securetoken.google.com/my-app",
"aud": "my-project-name",
"auth_time": 1606358478,
"user_id": "F2isYDFZAdZPNq...",
"sub": "F2isYDFZAdZPNq3Ql5q...",
"iat": 1606362935,
"exp": 1606366961,
"email": "myemail@something.com",
"email_verified": true,
"firebase": {
"identities": {
"google.com": [
"1028632529678233276"
],
"email": [
"myemail@something.com"
]
},
"sign_in_provider": "google.com"
},
"jti": "cd1dfce4-de7c-44b7-9aa1-730sa"
}
And of course I am sending âX-Firebase-Token: myTokenâ to the header of apollo graphql. My app uses the email as the username.
So maybe the lack of a namespace is the problem? I do not generate any results, unless I remove the query rule in my schema. Has anyone gotten firebase auth to work? Again, any help is appreciated, I am so closeâŚ