Skip to content

Instantly share code, notes, and snippets.

View alvincrespo's full-sized avatar
:shipit:
Shipping Code.

Alvin Crespo alvincrespo

:shipit:
Shipping Code.
View GitHub Profile
@alvincrespo
alvincrespo / generate-application-authorizer.sh
Created November 17, 2017 15:44
Generate application authorizer
ember g authorizer application --base-class=oauth2
@alvincrespo
alvincrespo / configured-oauth-authenticator.js
Last active November 17, 2017 15:43
Configured oauth authenticator
// auth-example-frontend/app/authenticators/oauth2.js
import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant';
import config from 'my-app/config/environment';
const host = config.apiUrl || '';
const namespace = config.apiNamespace;
const serverTokenEndpoint = [ host, namespace, 'token' ];
export default OAuth2PasswordGrant.extend({
@alvincrespo
alvincrespo / oauth2.js
Created November 17, 2017 15:42
Generated Oauth Authenticator
// auth-example-frontend/app/authenticators/oauth2.js
import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant';
export default OAuth2PasswordGrant.extend({
});
@alvincrespo
alvincrespo / authenticator-generation-output.sh
Created November 17, 2017 15:41
Authenticator generation ouput
➜ ember g authenticator oauth2 --base-class=oauth2
installing authenticator
create app/authenticators/oauth2.js
@alvincrespo
alvincrespo / generate-oauth-authenticator
Created November 17, 2017 15:41
Generate Oauth Authenticator
ember g authenticator oauth2 --base-class=oauth2
@alvincrespo
alvincrespo / application.js
Created November 17, 2017 15:40
Application Adapter with ember-simple-auth configuration
// auth-example-frontend/app/adapters/application.js
import JSONAPIAdapter from 'ember-data/adapters/json-api';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
import config from 'my-app/config/environment';
export default JSONAPIAdapter.extend(DataAdapterMixin, {
host: config.apiUrl,
namespace: config.apiNamespace,
authorizer: 'authorizer:application'
@alvincrespo
alvincrespo / application.js
Created November 17, 2017 15:39
Generated Application Adapter
// auth-example-frontend/app/adapters/application.js
import DS from 'ember-data';
export default DS.JSONAPIAdapter.extend({
});
@alvincrespo
alvincrespo / create-application-adapter.sh
Created November 17, 2017 15:39
Create application adapter
➜ ember g adapter application
installing adapter
create app/adapters/application.js
installing adapter-test
create tests/unit/adapters/application-test.js
@alvincrespo
alvincrespo / install-ember-simple-auth-output.sh
Created November 17, 2017 15:38
Install ember-simple-auth output
➜ ember install ember-simple-auth
NPM: Installed ember-simple-auth
Installed addon package.
@alvincrespo
alvincrespo / install-ember-simple-auth.sh
Created November 17, 2017 15:38
Install ember-simple-auth
ember install ember-simple-auth