0

分離されたインフラストラクチャを初めて試しています。分離されたインフラストラクチャとは、2 つの分離したアプリがあることを意味します。

  1. API サービスとしてのみ機能する Rails アプリ
  2. すべてのフロントエンドを処理する Angular アプリ

現在、これは非常に単純なプロセスです (2 つのアプリの統合についてさらに学習しているため)。プラットフォーム間の通信は、ある種のトークンベースの認証などで保護する必要があることを理解しています。devise_token_authng-token-authを見ました。

現在、API を外部関係者に公開しないため、混乱しています。したがって、自分の API を使用できるようにしたい唯一のシステムは、自分のシステム (1 セットの秘密鍵) です。

devise_token_auth を使用して秘密鍵を生成し、それをサーバー側とクライアント側の両方の環境変数に追加すると言っているのは正しいですか? これらの値は現在静的であるため (ユーザー固有ではありません)

4

2 に答える 2

1

Definition of authentication is something like "confirming that a user is who he says he is". Since you won't have any users, auth is not applicable here.

One might argue that "user" in your case is the angular client and therefore, external users (other apps/scripts), not knowing the token, will be rejected. However, access token being public knowledge too, it does not add any protection against spam or whatever you were trying to achieve with this mechanism.

So, don't bother with it.

于 2015-09-07T14:23:42.947 に答える