I have added these 2 identity providers (refer attached images) to Google Cloud -->Identity Platform
- Email/Password
- OIDC Connect (oidc provider)
Now if you see there is a User section as well under Identity Platform So I have added some random users which are non gmail users (refer image), like [email protected], which I want to authenticate with the help of Google Cloud (it when this user comes to login, I will hit API endpoint /login and in login server side code, I will redirect to Google Cloud to Authenticate this user using OIDC Authorization flow)
I need Java code to :
- Using some java code, First choose the provider as OIDC provider (oidc-auth-provider).
- Make call to Google Cloud which should use this Provider (oidc-auth-provider)
- This oidc-auth-provider should look up the users which I have created under Users section (refer image)
- Google Cloud after verifying user exist, should send back with Auth Code
- using Auth Code I will call back to Google and get ID token/JWT token
I was referring to this link : https://cloud.google.com/identity-platform/docs/web/oidc If you search "Signing in users with OAuth" this section on page, that is what exactly I am looking for, but the problem is it has given a UI code example using Firebase API example, to create OAuthProvider instance (which will choose provider), but I need server side code example instead, I am not sure if I can use this Firebase API on server side java code for a web application? Any suggestion that how can I do similar things from a server side Java code?