DefaultGithubCredentialsProvider.getCredentials()
Home > @backstage/integration
> DefaultGithubCredentialsProvider
> getCredentials
Returns GithubCredentials for a given URL.
Signature:
getCredentials(opts: {
url: string;
}): Promise<GithubCredentials>;
Parameters
Parameter | Type | Description |
---|---|---|
opts | { url: string; } | The organization or repository URL |
Returns:
Promise<GithubCredentials>
A promise of GithubCredentials.
Remarks
Consecutive calls to this method with the same URL will return cached credentials.
The shortest lifetime for a token returned is 10 minutes.
Example
const { token, headers } = await getCredentials({
url: 'https://github.com/backstage/foobar'
})
const { token, headers } = await getCredentials({
url: 'https://github.com/backstage'
})