Quarkus - Calling Google service API OAuth2

59 Views Asked by At

I'm having some trouble trying to access an API from Google Developer APIs. I have an account and I have obtained the client id and client secret as well. However whenever I call the API, it seems to return a 401 error, but I don't understand why.

It seems to work fine on the website to test the API under my account here: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/get

I am following the documentation for Quarkus for this: https://quarkus.io/guides/security-openid-connect-providers

Not really sure where I am going wrong, if someone has some input, please feel free to share!

    @Path("androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}")
    @GET
    Uni<Response> getGooglePlayPurchasesSubscription(@PathParam("packageName") String packageName, @PathParam("subscriptionId") String subscriptionId, @PathParam("token") String token);

Here is the application properties:

quarkus.oidc.provider=google
quarkus.oidc.client-id=${GOOGLE_PLAY_CLIENT_ID}
quarkus.oidc.credentials.secret=${GOOGLE_PLAY_CLIENT_SECRET}
quarkus.oidc.application-type=service
quarkus.oidc.authentication.scopes=oidc,profile
quarkus.oidc.authentication.extra-params.scope=https://www.googleapis.com/auth/androidpublisher

google.play.console.email=${GOOGLE_PLAY_EMAIL}
google.play.console.password=${GOOGLE_PLAY_PASSWORD}
google-play-api/mp-rest/url=https://androidpublisher.googleapis.com

Let me know if need more details, thanks!

0

There are 0 best solutions below