Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java-client][google-api-client] authentication support? #3698

Open
jmini opened this issue Aug 20, 2019 · 2 comments
Open

[java-client][google-api-client] authentication support? #3698

jmini opened this issue Aug 20, 2019 · 2 comments

Comments

@jmini
Copy link
Member

jmini commented Aug 20, 2019

It seems to me that the google-api-client does not support authentication yet.

Tested with:

openapi: 3.0.1
info:
  title: ping test
  version: '1.0'
servers:
  - url: 'http://localhost:8082/'
  /ping/basicSecurity:
    post:
      operationId: pingBasicSec
      responses:
        '200':
          description: OK
      security:
        - httpBasic: []
  /ping/bearerSecurity:
    post:
      operationId: pingBearerSec
      responses:
        '200':
          description: OK
      security:
        - bearerAuth: []
components:
  securitySchemes:
    httpBasic:
      scheme: basic
      type: http
    bearerAuth:
      scheme: bearer
      bearerFormat: token
      type: http

I have opened this for tracking.
If anyone is interested by the feature, please comment bellow.

@auto-labeler
Copy link

auto-labeler bot commented Aug 20, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@alexbudarov
Copy link

For simple schemes (basic, bearer) the workaround is - to use HttpRequestInitializer when creating ApiClient.
E.g.:

HttpRequestInitializer initializer = request
                -> {
            request.getHeaders().setAccept("application/json");
            request.getHeaders().setAuthorization("Bearer " + token);
        };

        ApiClient client = new ApiClient(
                BASE_URL,
                null,
                initializer,
                null
        );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants