Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用Laravel和Ionic登录_Php_Json_Laravel_Typescript_Ionic Framework - Fatal编程技术网

Php 使用Laravel和Ionic登录

Php 使用Laravel和Ionic登录,php,json,laravel,typescript,ionic-framework,Php,Json,Laravel,Typescript,Ionic Framework,我是爱奥尼亚的新手,我需要将以下JSON帖子发送到我的后端Laravel应用程序 { "user" : "amk1", "pwd" : "schule123" } 我已经在Postman中测试了它,我需要存储以下JWT令牌 {"message":"success", "jwt":"token"} 首先,如何将JSON请求从ionic发送到Laravel应用程序我在login.page.ts中这样做的 login(form) { this.authService.log

我是爱奥尼亚的新手,我需要将以下JSON帖子发送到我的后端Laravel应用程序

{
    "user" : "amk1",
    "pwd" : "schule123"
}
我已经在Postman中测试了它,我需要存储以下JWT令牌

{"message":"success",
"jwt":"token"}
首先,如何将JSON请求从ionic发送到Laravel应用程序我在login.page.ts中这样做的

login(form) {
    this.authService.login(form.value).subscribe((res) => {
      this.router.navigateByUrl('home');
    });
  }
在auth.service.ts中我写了这个

export class AuthService {
    AUTH_SERVER_ADDRESS  =  'http://127.0.0.1:8000/checklogin';
    authSubject  =  new  BehaviorSubject(false);
    register: any;
    constructor(private  httpClient: HttpClient, private  storage: Storage) { }
      login(user: User): Observable<AuthResponse> {
        return this.httpClient.post(`${this.AUTH_SERVER_ADDRESS}`, user).pipe(
          tap(async (res: AuthResponse) => {

            if (res.user) {
              await this.storage.set('ACCESS_TOKEN', res.user.access_token);
              await this.storage.set('EXPIRES_IN', res.user.expires_in);
              this.authSubject.next(true);
            }
          })
        );
      }
那么,我遗漏了什么,以及如何存储用于身份验证的JWT令牌

error:
exception: "ErrorException"
file: "/Users/rotschaedl/DPA/tischreservierenp/app/Http/Controllers/MainController.php"
line: 124
message: "Undefined index: user"
trace: (56) 
__proto__: Object