Merge pull request #17605 from brianphillips/scm-auth-doc-additions

Add more context for how to make a custom SCM Auth provider work
This commit is contained in:
Patrik Oldsberg
2023-05-04 11:40:21 +02:00
committed by GitHub
+22 -1
View File
@@ -348,7 +348,28 @@ const gheAuthApiRef: ApiRef<OAuthApi & ProfileInfoApi & SessionApi> =
});
```
The new ref is then used to add a new provider to the ApiFactory:
This new API ref will only work if you define an API factory for it. For example:
```ts
createApiFactory({
api: gheAuthApiRef,
deps: {
discoveryApi: discoveryApiRef,
oauthRequestApi: oauthRequestApiRef,
configApi: configApiRef,
},
factory: ({ discoveryApi, oauthRequestApi, configApi }) =>
GithubAuth.create({
configApi,
discoveryApi,
oauthRequestApi,
defaultScopes: ['read:user'],
environment: configApi.getOptionalString('auth.environment'),
}),
});
```
The new API ref is then used to add a new provider to the ApiFactory:
```ts
createApiFactory({