简体   繁体   English

Ember-simple-auth会检查什么?

[英]What does Ember-simple-auth check against?

I have been looking for answer of implementing ember-simple-auth (oauth2-password-grant) for days without luck. 我一直在寻找实现ember-simple-auth(oauth2-password-grant)数天没有运气的答案。 I use firebase to sign up users, which is successful. 我使用Firebase来注册用户,这是成功的。 However on the log in page, the action of this.get('session').authenticate('authenticator:oauth2', credentials) seems to cause a json error (SyntaxError: Unexpected token < in JSON at position 0) . 但是在登录页面上, this.get('session').authenticate('authenticator:oauth2', credentials)似乎导致json错误(SyntaxError: Unexpected token < in JSON at position 0)

So my first question is, in theory, how does this authentication check if the user's email/password is correct? 因此,我的第一个问题是,从理论上讲,此身份验证如何检查用户的电子邮件/密码是否正确? Meaning, in which file is the "answer" located? 意思是,“答案”位于哪个文件中? Am I supposed to define a token? 我应该定义一个令牌吗? If yes, I already tried "serverTokenEndpoint: ' http://localhost:4200/ ' or serverTokenEndpoint: ' http://localhost:4200/token " and nothing works. 如果是,我已经尝试过“ serverTokenEndpoint:' http:// localhost:4200 / '或serverTokenEndpoint:' http:// localhost:4200 / token ”,但没有任何效果。 Thanks. 谢谢。

Ember simple auth sends login request to API(in your case Firebase). Ember简单身份验证将登录请求发送到API(在您的情况下为Firebase)。 If entered credentials are valid your API will authenticate user, create and save auth token. 如果输入的凭据有效,则您的API将对用户进行身份验证,创建并保存身份验证令牌。 Authenticated user with created token will be sent to Ember and token will be saved in local storage by Ember simple auth. 具有创建的令牌的已认证用户将被发送到Ember,令牌将通过Ember简单身份验证保存在本地存储中。 Every subsequent request from Ember after login needs to include that token in its header and API will authenticate your request based on that token(comparing token from Ember with the one saved in API). 登录后,Ember发出的每个后续请求都需要在其标头中包含该令牌,API会根据该令牌对您的请求进行身份验证(将Ember的令牌与API中保存的令牌进行比较)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM