public Task <string> GetRedirect(string callbackUrl, long?userId) { var state = JWT.CreateSecurityToken( appConfig: _appConfig, entityId: userId?.ToString() ?? Guid.NewGuid().ToString("N"), securityStamp: "", audience: JwtAudience.Cabinet, area: JwtArea.OAuth, validFor: TimeSpan.FromMinutes(5), optClaims: new[] { new System.Security.Claims.Claim("google", "true") } ); var paramz = new Parameters() .Set("scope", "https://www.googleapis.com/auth/userinfo.email") .Set("access_type", "offline") .Set("include_granted_scopes", "true") .Set("state", state) .Set("redirect_uri", callbackUrl) .Set("include_granted_scopes", "true") .Set("response_type", "code") .Set("client_id", _clientId) ; return(Task.FromResult("https://accounts.google.com/o/oauth2/v2/auth?" + paramz.ToUrlEncoded())); }