superfaceai / service-client

Library provides client for superface backend apis.
MIT License
5 stars 1 forks source link

feat: Access token getter #89

Closed kysely closed 1 year ago

kysely commented 1 year ago

Description

This PR adds getAccessToken method.

Motivation and Context

We have new clients that use access token when interacting with our backends. They need to manually get and keep track of access token that 1) isn't exposed from the client 2) expires every 15 minutes.

The new getAccessToken method is a simple interface for getting the always up-to-date token.

Types of changes

Checklist:

freaz commented 1 year ago

Way better would be to work with baseUrl in fetch. To avoid what Jan mentioned and use existing authentication flow.

What do you need to call? Edgar OneService?

kysely commented 1 year ago

You're right — the frontend needs to call 1) engine API 2) OneService.

With OneService it would be a bit hacky since GraphiQL uses single absolute URL instead of baseURL + path but probably still better than this solution. I'll add that.

kysely commented 1 year ago

Attempt at #90