Skip to content

Spring Oauth2 Resource Server Invalid Bearer Token Exception #11976

@abidino

Description

@abidino

Hi i am new for oauth2 spesification and i try login with google provider. i have gateway and backend service in my project.
Gateway is a oauth2 client, Backend servise is a oauth2 resource server.

i create a token with oauth2 client in my api gateway and i request my backend service by this token but response is always 401

image

my configuration is true and i am able to validate google openApi url but my backend servise is not able to validate my token.
openApiurl -> https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=accessToken

it is example token = Bearer ya29.a0Aa4xrXNR2aR78a9Qkq-cTQvB8GsRdMiy4MjZnXXqK3HrCRBEBby_-tnekMxr2VP5Stw67oKcPsby14MK3Ppfi5nCN0lbzWkxX3z-DhZsCAtwGX24JKkryHudFo_Mk7OGKwwVy127fp1zlWXzW3sLvJlSmMl-aCgYKATASARMSFQEjDvL9KbonzV4tPnjEB3TVBPe3sg0163

Project's url
https://github.com/abidino-events/api-gateway --> gateway
https://github.com/abidino-events/mail-service --> backend service

My sources are https://docs.spring.io/spring-security/reference/servlet/oauth2/resource-server/jwt.html, https://www.baeldung.com/spring-cloud-gateway-oauth2

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: stackoverflowA question that's better suited to stackoverflow.com

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions