我正在尝试使用邮递员对firebase进行REST API调用.当我的安全规则允许所有用户包括未经授权的用户时,我已设法从firebase读取.
但是当我使用这条规则时:
{"rules":{".read": "auth != null", ".write": "auth != null"}}
Run Code Online (Sandbox Code Playgroud)
我得到了'错误':来自邮递员的"许可被拒绝".我为google的web oauth2.0客户端做了请求令牌,并获得了authorization_code令牌.
我试图在URL和标题中使用令牌,尝试使用GET和POST请求并仍然被拒绝.
请帮忙.提前致谢
这是我的模特
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class OrganizationProfile extends Model
{
protected $fillable = [
'logo',
'number_of_employees',
'siup', 'npwp', 'year_established', 'join_ppsdm', 'industry_sector',
'address', 'city', 'province', 'country',
'postal_code',
'organization_phone',
'organization_email'
];
}
Run Code Online (Sandbox Code Playgroud)
OrganizationProfile的迁移表
Schema::create('organization_profiles', function (Blueprint $table) {
$table->unsignedInteger('organization_id');
$table->primary('organization_id');
$table->foreign('organization_id')->references('id')->on('organizations')->onDelete('cascade');
$table->string('logo')->nullable();
$table->integer('number_of_employees')->nullable();
$table->string('siup')->nullable();
$table->string('npwp')->nullable();
$table->integer('year_established')->nullable();
$table->integer('join_ppsdm')->nullable();
$table->string('industry_sector')->nullable();
$table->text('address')->nullable();
$table->string('city')->nullable();
$table->string('province')->nullable();
$table->string('country')->nullable();
$table->string('postal_code')->nullable();
$table->string('organization_phone')->nullable();
$table->string('organization_email')->nullable();
$table->text('meta')->nullable();
$table->timestamps();
});
Run Code Online (Sandbox Code Playgroud)
这在我的控制器中:
$org = OrganizationProfile::where('organization_id', $id)->first();
if ($org == null) {
$org = new OrganizationProfile();
$org->organization_id = $id;
}
$org->fill($request->input())->save();
Run Code Online (Sandbox Code Playgroud)
eloquent尝试使用'id'作为参考来更新更改的值.我没有'id'字段,我有'organization_id'作为主键和外键.如果我不更改$ fillable中列出的任何值,则不会显示此错误.
提前致谢