Skip to content

Instantly share code, notes, and snippets.

@medokin
Last active August 30, 2016 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save medokin/9069e2fc48c7e290f71f0ca2308d63be to your computer and use it in GitHub Desktop.
Save medokin/9069e2fc48c7e290f71f0ca2308d63be to your computer and use it in GitHub Desktop.
Oauth Test
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddles',
actions: {
authenticateOAuth(){
this.get('torii').open('gitlab-oauth2').then(function(authorization){
// FB.api is now available. authorization contains the UID and
// accessToken.
controller.set('hasFacebook', true);
});
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<button {{action 'authenticateOAuth'}}>
Login
</button>
<br>
<br>
import Provider from 'torii/providers/oauth2-bearer';
import {configurable} from 'torii/configuration';
/**
* This class implements authentication against Azure
* using the OAuth2 authorization flow in a popup window.
* @class
*/
var GitlabOauth2 = Provider.extend({
name: 'gitlab-oauth2',
baseUrl: 'https://gitlab.com/oauth/authorize',
// additional url params that this provider requires
requiredUrlParams: ['client_id'],
responseParams: ['code'],
clientId: '4c605021ea85362d64ef8511b8b509d41df49ea98b59421a69f922fe44dd2e92',
redirectUri: 'https://ember-twiddle.com/9069e2fc48c7e290f71f0ca2308d63be',
});
export default GitlabOauth2;
{
"version": "0.10.4",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.6.0",
"ember-data": "2.6.0",
"ember-template-compiler": "2.6.0"
},
"addons": {
"torii": "0.8.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment