Exemplo n.º 1
0
 public AccountController(ILogger <AccountController> logger, FtmDbContext context, IConfiguration configuration, ClientInfo clientInfo, FtmDataStore dataStore)
 {
     this.logger        = logger;
     this.context       = context;
     this.configuration = configuration;
     this.clientInfo    = clientInfo;
     this.dataStore     = dataStore;
 }
Exemplo n.º 2
0
 public EventsController(ClientInfo clientInfo, FtmDbContext context, FtmDataStore dataStore, IConfiguration configuration)
 {
     this.clientInfo    = clientInfo;
     this.context       = context;
     this.dataStore     = dataStore;
     this.configuration = configuration;
     this.baseLink      = this.configuration["Settings:BaseLink"];
 }
Exemplo n.º 3
0
        public static BaseClientService.Initializer Create(FtmDbContext context, ClientInfo clientInfo, FtmDataStore dataStore)
        {
            var flow = new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
            {
                ClientSecrets = new ClientSecrets
                {
                    ClientId     = clientInfo.ClientId,
                    ClientSecret = clientInfo.ClientSecret,
                },
                DataStore = dataStore, // match the one defined in OnAuthorizationCodeReceived method
            });
            var ftmToken = context.FtmTokenResponses.First(x => x.UserId == Constains.UserId);

#pragma warning disable CS0612 // Type or member is obsolete
            var tokenResponse = ftmToken.GetTokenResponseInfo();
#pragma warning restore CS0612 // Type or member is obsolete
            var userCredential = new UserCredential(flow, Constains.UserId, tokenResponse);
            return(new BaseClientService.Initializer()
            {
                HttpClientInitializer = userCredential
            });
        }