Repository navigation
Global Oauth #9860
|
Hi all, I have a fairly large API which is split into sections e.g Weather,Sport etc, in Bruno I have setup collections in their own folders for each section. What i would like to do, is, have a central location for oAuth is there a way to do this ? Currently as I have a top level folder for each section(collection) I have to setup auth on every folder. Thanks for reading |
Replies: 1 comment 1 reply
|
Yes, if the sections are folders inside one collection. Set OAuth2 once on the collection and let everything below it inherit:
At send time Bruno walks from the request up through its folders and uses the closest folder with a real auth mode, falling back to the collection's auth ( When the auth comes from the collection, the token is stored once for the collection and reused by every request under it, so you fetch it once instead of once per folder. If they're actually separate collections, there's no level above the collection to put auth on, and tokens are stored per collection (store/oauth2.js). Moving them into one collection with a folder per section is the clean fix. If you need to keep them apart, put the token URL, client ID and secret in a global environment and reference them as |
Yes, if the sections are folders inside one collection. Set OAuth2 once on the collection and let everything below it inherit:
At send time Bruno walks from the request up through its folders and uses the closest folder with a real auth mode, falling back to the collection's auth (
mergeAuthin collection.js). Onlyinheritis skipped on the way up, so a folder set to No Auth stops the chain. Make sure the folders say Inherit, not No Auth. New folders are already created with Inherit (actions.js), so you'd mostly be switch…