2016-06-17 4 views
0

요청에서 권한 부여 : 애플리케이션이 설정되는 위치를 파악하려고합니다. 헤더의 어딘가에 있어야합니까? 앱에서 요청할 때 nodejs 엔드 포인트의 요청에서 찾을 수 없습니다.NodeJS 엔드 포인트에서 Ember-Simple-Auth-Token 인증 헤더에 액세스하는 방법

import DS from "ember-data"; 
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin'; 

export default DS.RESTAdapter.extend(DataAdapterMixin, { 
    authorizer: 'authorizer:application', 

그리고 엔드 포인트는 간단하다 :

내가 엠버 (어댑터/application.js)에있는 코드는 내가이 권한 부여를 찾을 수 있습니다 희망 REQ 로그인 한

exports.getAuthorizer = function(req, res) { 
    console.log(req); 
} 

안에 있지만 찾을 수는 없습니다.

당신은 알려 주시기 바랍니다 자세한 정보가 필요한 경우, 감사

엠버 - 간단한 인증 토큰 : https://github.com/jpadilla/ember-simple-auth-token

답변

0

난 그냥 간단하게 다음을 수행하는 데 필요한 API에 권한 부여 토큰에 액세스하려면 :

https://github.com/auth0/express-jwt

exports.getAuthorizer = function(req, res) { 
    if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') { 
    return req.headers.authorization.split(' ')[1]; 
    } else if (req.query && req.query.token) { 
    return req.query.token; 
    } else { 
    return null; 
    } 
} 

는 처음에이 일에서 저를 막는 것은 헤더 가자이었다이었다 r을 보냈습니다. 나는 ember-simple-auth뿐만 아니라 ember-cli- simple-auth도 가지고있었습니다.

수정 프로젝트에서 엠 - - CLI 단순 인증 및 엠-CLI-간단한 인증 토큰을 제거 하였다 (https://github.com/jpadilla/ember-simple-auth-token/issues/96)