Huachao / vscode-restclient

REST Client Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=humao.rest-client
MIT License
5.32k stars 446 forks source link

Is there an example to authenticate against a REST API which needs authentication against google oauth? #1231

Open davidkoenig-shiftavenue opened 11 months ago

davidkoenig-shiftavenue commented 11 months ago

I have an REST API where it is needed to authenticate against google oauth to access the endpoints. There is just a /login path available where the typical login page opens. Is there an example available how to authenticate against this scenario?

franck-chester commented 8 months ago

I do something like this

OAuth2

@name oauth2

POST https:///oauth/token?grant_type=client_credentials&client_id={{ClientID}}&client_secret={{Secret}} Content-Type: application/x-www-form-urlencoded

GET https:///resource Authorization: Bearer {{oauth2.response.body.access_token}}

Send the oauth2 request everytime you need a fresh token

AlexF4Dev commented 4 months ago

I have added PR which allows to get and use an access token from any OIDC provider: https://github.com/Huachao/vscode-restclient/pull/1282. No stored secrets required.