docs: scaffolder: improve docs to setup the RepoUrlPicker authentication

Signed-off-by: Maixmilian Ressel <maximiliandotressel@gmail.com>
This commit is contained in:
Maixmilian Ressel
2022-06-14 16:22:54 +02:00
parent c2f9527fe2
commit 85f2d90543
3 changed files with 22 additions and 1 deletions
+18
View File
@@ -185,6 +185,24 @@ const app = createApp({
When using multiple auth providers like this, it's important that you configure the different
sign-in resolvers so that they resolve to the same identity regardless of the method used.
## Scaffolder Configuration (Software Templates)
If you want to use the authentication capabilities of the [Repository Picker](../features/software-templates/writing-templates.md#the-repository-picker) inside your Software Templates you will need to configure the [`ScmAuthApi`](https://backstage.io/docs/reference/integration-react.scmauthapi) alongside your authentication provider. It is an API used to authenticate towards different SCM systems in a generic way, based on what resource is being accessed.
To set it up, you'll need to add an API factory entry to `packages/app/src/apis.ts`. The example below sets up the `ScmAuthApi` for an already configured GitLab authentication provider:
```ts
createApiFactory({
api: scmAuthApiRef,
deps: {
gitlabAuthApi: gitlabAuthApiRef,
},
factory: ({ gitlabAuthApi }) => ScmAuth.forGitlab(gitlabAuthApi),
});
```
In case you are using a custom authentication providers, you might need to add a [custom `ScmAuthApi` implementation](./index.md#custom-scmauthapi-implementation).
## For Plugin Developers
The Backstage frontend core APIs provide a set of Utility APIs for plugin developers