daviddev95
daviddev95

Reputation: 29

Using Firebase OpenID Connect provider as Azure Function App Identity Provider

I have a react-native app that handles authentication using Firebase. That works great

The app calls serverless functions in Azure which id like to add authentication to by selecting an identity provider.

Azure Function App Identity Provider Options

Ive tried using OpenID Connect with the following configuration values but had no luck

metadata url: https://securetoken.google.com/{my-project-id}/.well-known/openid-configuration

client id: 412-3gp*******************.apps.googleusercontent.com

client secret: taken from the link below

https://console.cloud.google.com/apis/credentials?authuser=1&project={my-project-id}&supportedpurview=project

Firebase OpenId configuration

Process:

  1. Get idToken from the already-authenticated Firebase user in my app
  2. Pass that (jwt)idToken as a Bearer authentication header when calling my Azure function

Result:

401 unauthorised response No response body is present

Expected result:

200 response

Does anyone know if its possible to use Firebase as an OpenId identity provider and if so, where I should get the correct ClientId and Client secret values from?

I notice the are some value in the Firebase console and also some in the Google cloud console

Upvotes: 3

Views: 673

Answers (1)

AndyM
AndyM

Reputation: 1200

I've been facing exactly the same issue this morning and managed to get it working.

I initially did the same as you and set the client ID to be xxxxxxxx.apps.googleusercontent.com. That client ID value came from the same page you have liked to above for the client secret. Those values still resulted in the 401 error.

When I changed the client ID to be the Firebase project ID it all started working as expected.

Upvotes: 1

Related Questions