Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@octokit/auth-callback
Advanced tools
Readme
GitHub API authentication using a callback method
Browsers |
Load
|
---|---|
Node |
Install with
|
let token;
const auth = createCallbackAuth({ callback: () => token });
await auth();
// {
// type: 'unauthenticated'
// }
token = "secret123";
await auth();
// {
// type: 'token',
// token: 'secret123',
// tokenType: 'oauth'
// }
createCallbackAuth(options)
The createCallbackAuth
method accepts a single options
parameter
name | type | description |
---|---|---|
options.callback
|
function
| Required. A method that returns or resolves with a token string. |
auth()
The async auth()
method does not accept any arguments
The async auth()
method resolves to one of two possible authentication objects
callback()
returns or resolves a falsy valuecallback()
returns or resolves with a string valuename | type | description |
---|---|---|
type
|
string
|
"unauthenticated"
|
name | type | description |
---|---|---|
type
|
string
|
"token"
|
token
|
string
| The personal access token |
tokenType
|
string
|
One of:
|
auth.hook(request, route, parameters)
or auth.hook(request, options)
auth.hook()
hooks directly into the request life cycle. It amends the request to authenticate correctly based on the request URL.
The request
option is an instance of @octokit/request
. The route
/options
parameters are the same as for the request()
method.
auth.hook()
can be called directly to send an authenticated request
const { data: user } = await auth.hook(request, "GET /user");
Or it can be passed as option to request()
.
const requestWithAuth = request.defaults({
request: {
hook: auth.hook,
},
});
const { data: user } = await requestWithAuth("GET /user");
See CONTRIBUTING.md
FAQs
GitHub API authentication using a callback method
The npm package @octokit/auth-callback receives a total of 254 weekly downloads. As such, @octokit/auth-callback popularity was classified as not popular.
We found that @octokit/auth-callback demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.