授权的JavaScript起源

时间:2017-05-26 06:45:41

标签: javascript php

我正在开发一个电子邮件服务并希望与Google帐户建立联系,是否可以将我的localhost用作授权JavaScript来源?

3 个答案:

答案 0 :(得分:1)

第1步:启用Google+ API

http://localhost:4567
https://myproductionurl.example.com

第2步:设置JavaScript快速入门应用

git clone https://github.com/googleplus/gplus-quickstart-javascript.git
wget https://github.com/googleplus/gplus-quickstart-javascript/archive/master.zip -o gplus-quickstart-javascript.zip
unzip gplus-quickstart-javascript.zip
cd gplus-quickstart-javascript

第3步:运行快速入门应用

答案 1 :(得分:0)

是的,你可以根据documentation

  

在“授权的JavaScript来源”字段中,输入应用的来源。您可以输入多个来源,以允许您的应用在不同的协议,域或子域上运行。你不能使用通配符。在下面的示例中,第二个URL可以是生产URL。

http://localhost:4567
https://myproductionurl.example.com

答案 2 :(得分:0)

我是这么认为的。请务必在凭据中输入您的公共IP地址。您可以通过请求whatsmyip.org

等网站来查找

它还需要一个http://或https://前缀,这样你最终会得到类似 public static void showAlert(String msg, final Context context) { final AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setCancelable(false); builder.setTitle("Alert"). setMessage(msg). setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); AlertDialog dialog = builder.create(); dialog.show(); }

的内容