Please help me,

When I am try to login from angular 4 app to web2py rest api browser shows 
error like

OPTIONS http://127.0.0.1:8000/csautomation/user/login 405 (METHOD NOT 
ALLOWED)

*AND*

Failed to load http://127.0.0.1:8000/csautomation/user/login: Response to 
preflight request doesn't pass access control check: No 
'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost:4200' is therefore not allowed access. The 
response had HTTP status code 405.

*here is my angular code*

login(user): Promise<any>{
  let url: string = `${this.BASE_URL}/login`;
  return this.http.post(url,user).toPromise();
  }

*here my web2py api*

@request.restful()
def login():
    def POST(username, password):
        user = auth.login_bare(username, password)
        if user:
            return json(user.id)
        return user
    return locals()


Thanks for any help

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to