1

現在アンドロイドスタジオとアンドロイドスタジオのGoogleクラウドエンドポイントモジュールを使用してAndroidアプリを開発中です。だから、Firebase Authを使ってユーザ認証を追加しようとしているので、ユーザに異なるユーザのサインインオプションを提供することができます。しかし、いつでも私のエンドポイントクラスのAPIに認証コードを追加しようとします。 apiIssuerとApiissuerAudienceは常に解決されません。私はすべてを試しましたが、私は問題を解決できないので、コードのこの部分に影響するために何かやっていないか、何か間違っていたと仮定しています。Google Cloud Enpointを使用する際の認証の問題

package com.example.Kendrickod.myapplication.backend; 

import com.example.Kendrickod.myapplication.backend.domain.Profile; 
import com.google.api.server.spi.auth.EspAuthenticator; 
import com.google.api.server.spi.config.Api; 
import com.google.api.server.spi.config.ApiMethod; 
import com.google.api.server.spi.config.ApiNamespace; 
import com.google.api.server.spi.config.Named; 

/** 
* Defines event APIs. 
*/ 


/** An endpoint class we are exposing */ 
@Api(name = "event", 
    version = "v1", 
    namespace = @ApiNamespace(ownerDomain = 
    "backend.myapplication.Kendrickod.example.com", 
      ownerName = "backend.myapplication.Kendrickod.example.com", 
      packagePath = ""), 
    authenticators = {EspAuthenticator.class}, 
    issuers = { 
      @ApiIssuer(
        name = "firebase", 
        issuer = "https://securetoken.google.com/YOUR-PROJECT-ID", 
        jwksUri = "https://www.googleapis.com/service_accounts/v1/metadata/x509/[email protected]") 
    }, 
    issuerAudiences = { 
      @ApiIssuerAudience(name = "firebase", audiences = "YOUR-PROJECT-ID") 
    }, 
    clientIds = {Constants.WEB_CLIENT_ID, Constants.ANDROID_CLIENT_ID, Constants.IOS_CLIENT_ID}, 
    audiences = {Constants.ANDROID_AUDIENCE}) 

public class EventApi { 


} 

答えて

0

このライブラリを含める必要があります。

com.google.endpoints:エンドポイント・フレームワーク-AUTH:1.0.2

それは些細なしかし、見つけるのは簡単ではないようだ...私はそれらすべてを試してみました。

あなたは、Android Studioを使用する場合は、/編集ライブラリーを構築するために行くと、「+」をクリックしdependenciesmと、「エンドポイント・フレームワーク」

+0

申し訳ありませんが、あなたもcom.google.endpointsをインポートする必要がありを検索:endpoints-フレームワークライブラリを作成し、他のすべてのライブラリより前に置くように注意してください...それだけです! –

+0

ありがとう!それが機能しました。私はそれが私の図書館と関係していたと感じました。 –

関連する問題