ahh
With the SAML sign in, the ID token issued by Firebase obviously includes the unique user id. I think it’s not a uuid but rather just a “subject id”, and it is carried in the “sub” claim. And the SAML Assertion produced by the IdP I built, does include this claim as an Attribute in the AttributeStatement (standard part of a SAML Assertion response to AuthnRequest).
But, the developer portal doesn’t DO anything with that Attribute; and specifically it doesn’t attach that ID to the developer entity during auto-registration at sign-in. It would be nice if the developer portal did that automatically, and I think it’s a good feature enhancement request, but today that does not happen.
You suggested that Apigee could “call out” to …something… with the developer’s email address, to retrieve that ID. And the answer to that is YES, you can do that. You would need to configure the service callout to make a call like this:
POST :idtk/v1/projects/:proj/accounts:lookup
x-goog-user-project: :proj
Authorization: Bearer :token
content-type: application/json
{
"email" : [ "username@gmail.com" ]
}
Documented here. And the result there includes a localId, which is the same as the “sub” claim. You could then attach that to the developer entity, and subsequently skip that ServiceCallout.
One note. The x-goog-user-project header there is required if you are invoking the REST API directly. This obscure header is documented here. Here’s why it’s needed. Many (most) APIs or services in the googleapis.com universe are resource-billed APIs. If you use them, then the billing accrues to the resource itself. A good example is BigQuery; if you send queries, the project hosting the BigQuery is the one that gets billed. Similarly for storage, or VertexAI, or etc. The identitytookit api is different. It is what is known as a client-based service, per that documentation. I think that’s misleading or confusing, or just wrongly worded. It’s client-based billing. Or better phrased as client-billed which I think captures the essence of it better. It says the CALLER gets billed. Not the project that owns the resource. So when you do a lookup on a user, YOU the caller get billed, not the project that “manages” the identity platform configuration. I amnot sure why it’s important to use different billing models, but I guess it makes sense for an IdP. that way if some project issues lots of requests against the identity platform, the caller pays the cost. ok makes sense. ANYWAY, you must pass the x-goog-user-project header to indicate which project to bill ! That project might be distinct from the project that is the home of the identity platform.
Obviously you need the appropriate authorization in order to perform that call. Per the doc, Authorization requires the following IAM permission on the specified target Project: firebaseauth.users.get .