From ffeb1c3784052c6a8c45e811d6801653e7817721 Mon Sep 17 00:00:00 2001 From: Brian Phillips <28457+brianphillips@users.noreply.github.com> Date: Mon, 1 May 2023 23:34:05 -0500 Subject: [PATCH] Add more context for how to make a custom SCM Auth provider work Signed-off-by: Brian Phillips <28457+brianphillips@users.noreply.github.com> --- docs/auth/index.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/auth/index.md b/docs/auth/index.md index abe7fb8db6..b2aac47e2a 100644 --- a/docs/auth/index.md +++ b/docs/auth/index.md @@ -348,7 +348,28 @@ const gheAuthApiRef: ApiRef = }); ``` -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({