selfbits / selfbits-angular2-sdk

Angular 2 SDK for Selfbits Backend-as-a-Service
https://www.selfbits.io
MIT License
7 stars 2 forks source link

401 error on console "message":"App Id is missing"} #1

Closed gilbertlucas46 closed 7 years ago

gilbertlucas46 commented 7 years ago

Hi I'm currently following instructions in http://blog.selfbits.io/blog/tutorial/angular2/2016/11/24/dashboard-tutorial-part2-email-auth image I'm now in the part where I need to test the connection in the register form image

I'm not really sure what I did wrong.. you can check the actual page here. http://cheapytrippy.com/dashboard/#/login

Hope to get support from you guys soon :)

kreck commented 7 years ago

The problem was is the missing 'sb-app-id' in the header when implementing the signUp method.

signup(formData:auth):Observable<Response>{
    return this.http.post(
      `${this.config.BASE_URL}/api/v1/auth/signup`,
      JSON.stringify(formData),
      {headers:new Headers({'Content-Type':'application/json','sb-app-id':this.config.APP_ID,'sb-app-secret':this.config.APP_SECRET})})
  }

At 'sb-app-id':this.config.APP_ID it is literally 'sb-app-id'. It is the name of the http header which is assigned the APP_ID value (that 32 digit key) from the config Object.

gilbertlucas46 commented 7 years ago

thanks @kreck it's working now