使用Ember CLI,我在使用torii工作时使用简单的auth很麻烦。
创建新的Ember CLI应用程序并安装torii,ember-cli-simple-auth和ember-cli-simple-auth-torii后,我的登录页面上有几个按钮
以下是我的路线/ login.js的内容:
CheckIn
我的environment.js文件的相关部分是:
Meeting
当我点击login.js中的操作时,出现以下错误:
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
googleLogin: function() {
this.get('session').authenticate('simple-auth-authenticator:torii', 'google-oauth2');
return;
},
facebookLogin: function() {
this.get('session').authenticate('simple-auth-authenticator:torii', 'facebook-oauth2');
return;
}
}
});
或
var ENV = {
...
torii: {
providers: {
'google-oauth2': {
apiKey: 'api-key-here',
scope: 'profile',
redirectUri: 'http://localhost:4200'
},
'facebook-oauth2': {
apiKey: 'api-key-here',
redirectUri: 'http://localhost:4200'
}
}
},
...
};
为什么torii没有拿起我的environment.js配置?
答案 0 :(得分:0)
你需要在facebook和google中创建应用程序,获取api密钥并将其放在它所说的位置:
#include <stdio.h>
#include <stdlib.h>
// convert the calculated greyscale to a character based on brightness
char method_of_conversion(int greyscale){
if(greyscale >= 230){
return ' ';
}else if(greyscale >= 200 && greyscale < 230){
return '.';
}else if(greyscale >= 180 && greyscale < 200){
return '\'';
}else if(greyscale >= 160 && greyscale < 180){
return ':';
}else if(greyscale >= 130 && greyscale < 160){
return 'o';
}else if(greyscale >= 100 && greyscale < 130){
return '&';
}else if(greyscale >= 70 && greyscale < 100){
return '8';
}else if(greyscale >= 50 && greyscale < 70){
return '#';
}else if(greyscale < 50){
return '@';
}
}
int main(){
char ppmFile[100];
char outputFile[100];
int n;
scanf("%s", &ppmFile); //read the name of input file
scanf("%s", &outputFile); //read the name of output file
// the size of a window of pixels you have to convert to ascii art character
scanf("%d", &n);
FILE *input = fopen(ppmFile, "rb");
FILE *output = fopen(outputFile, "w");
int width, height; // max pixel is always 255
// read the header from the ppm file
fscanf(input, "P6\n%d %d\n255\n", &width, &height);
// allocate place for array[width][length][3]
int a, b;
int ***array;
array = malloc(width*sizeof(int **));
for(a = 0; a < width; a++){
array[a] = malloc(height*sizeof(int *));
for(b = 0; b < height; b++){
array[a][b] = malloc(3*sizeof(int));
}
}
int x, y;
for (x = 0; x < width; x++){
for(y=0; y < height; y++){
array[x][y][0] = fgetc(input); //red
array[x][y][1] = fgetc(input); //green
array[x][y][2] = fgetc(input); //blue
int greyscale;
int i, j;
// convert blocks of pixels to a character and write it into output file
for(i = 0; i < width; i+=n){
for(j=0; j < height; j+=n){
// greyscale = (red + green +blue)/3;
greyscale = (array[i][j][0] + array[i][j][1] +array[i][j][2])/(3*n*n);
char c = method_of_conversion(greyscale);
fprintf(output,"%c",c); // write the ASCII art directly in the output file
}
}
}fprintf(output,"\n"); // dont forget to go into a new line
}
free(array);
fclose(input);
fclose(output);
return 0;
}
在你的environment.js
答案 1 :(得分:0)
原来我的问题很简单,需要重启的是ember serve进程(Ctrl + c,然后重新运行ember serve)。