我的应用程序调用 Google Oauth(该应用程序是在 Google Cloud 控制台中设置的)。当用户看到 Google Oauth 同意屏幕时,例如,批准访问 adwords api 时,是否有办法控制范围预选?
理想的情况是能够访问预先选择的 Google AdWords,然后用户如果愿意的话可以取消选择它?
是否可以通过编程或在 Google Cloud 控制台中进行设置来对其进行任何级别的控制?
问题是,就目前情况而言,当用户第一次看到 Google Oauth 窗口时,会看到应用程序要求的范围,它们是未勾选的复选框,根据我的经验,很多用户忘记勾选它们,但应用程序取决于对它们的访问。
正如您在上图中看到的,对于某些范围,我需要明确单击以允许应用程序访问。
另外,以上内容是为了表明我已获得此类范围的批准。
我见过一些其他应用程序,它们只是作为事实呈现给用户(该应用程序需要这些范围,并且用户无法取消选择它们)
我想在 Angular/Typescript 中实现策略模式并在组件中使用服务;服务采用策略接口作为构造函数参数。此外,约束是服务依赖于角度级别上的一些其他注入服务。
我正在深入研究文档,但无法找到一种方法来做到这一点。我不希望最终出现过度设计的代码,而是寻找简单的解决方案来实现策略模式。
请参阅下面的模拟代码:
export interface IStrategy {
calculate(a,b): number;
}
export class MinusStrategy implements IStrategy {
calculate(a,b): number {
return a - b;
}
}
export class PlusStrategy implements IStrategy {
calculate(a,b): number {
return a + b;
}
}
@Injectable()
export class CalculatorService {
// I understand it is not possible to have DI of the Interface here for calcStrategy
constructor(private http: HttpClient; private calcStrategy: IStrategy);
getByCalc() {
this.http.get('someurl?calc=' + calcStrategy.calculate(1,1));
}
}
@Component(// skipped config here...) …Run Code Online (Sandbox Code Playgroud)