Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
ember-data-github
Advanced tools
Ember Data abstraction for the GitHub API.
ember install ember-data-github
You need to choose how you wish to authenticate your GitHub requests using OAuth. ember-data-github
provides a simple
and direct mechanism that is specific to itself. Alternatively, you can use a more general authentication framework like
ember-simple-auth
.
If you already have a token to use the OAuth endpoints, such as a Personal access token, you must set the property
named githubAccessToken
on github-session
service with the currently logged in user's GitHub access token.
ember-simple-auth
If you are using ember-simple-auth (ESA) to authenticate, perhaps with
torii and ESA's torii-provider
, you can authenticate by creating a github
authorizer and extending ember-data-github
's adapter for each model you use. See the respective addon docs and
GitHub's OAuth docs to set it up.
Once you have a token, the authorizer will look like
// app/authorizers/github.js
import Ember from 'ember';
import Base from 'ember-simple-auth/authorizers/base';
export default Base.extend({
session: Ember.inject.service(),
authorize(sessionData, block) {
if (this.get('session.isAuthenticated') && !Ember.isEmpty(sessionData.access_token)) {
block('Authorization', `token ${sessionData.access_token}`);
}
}
});
assuming access_token
is the name of the property containing the token. This automatically injects the Authorization
header into the API requests using ESA mechanisms.
An extended adapter for github-user
would look like
// app/adapters/github-user.js
import GitHubUserAdapter from 'ember-data-github/adapters/github-user';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
export default GitHubUserAdapter.extend(DataAdapterMixin, {
authorizer: 'authorizer:github'
});
The following examples show how to retrieve each supported GitHub entity as you might use it in your model
hook.
this.get('store').findRecord('github-user', '#'); // get the current user
this.get('store').findRecord('github-user', 'jimmay5469'); // get a user
this.get('store').findRecord('github-repository', 'jimmay5469/old-hash'); // get a repository
this.get('store').findRecord('github-branch', 'jimmay5469/old-hash/branches/master'); // get a branch
this.get('store').queryRecord('github-branch', { repo: 'jimmay5469/old-hash', branch: 'master' }); // get a specific branch
this.get('store').query('github-branch', { repo: 'jimmay5469/old-hash' }); // get a repo's branches
this.get('store').queryRecord('github-release', { repo: 'jimmay5469/old-hash', releaseId: 1 }); // get a specific release
this.get('store').query('github-release', { repo: 'jimmay5469/old-hash' }) // get a repo's releases
git clone git@github.com:elwayman02/ember-data-github.git
cd ember-data-github
npm install
bower install
ember serve
npm test
(Runs ember try:each
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit https://ember-cli.com/.
v0.3.0 (2016-12-19)
FAQs
Ember Data abstraction for the GitHub API
The npm package ember-data-github receives a total of 29 weekly downloads. As such, ember-data-github popularity was classified as not popular.
We found that ember-data-github demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.