How to fix issue “POST xhr with 401 unauthorised error”,When i create a new announcement in canvas

I implemented new Project in Ruby on Rails

In my project I Created page “Announcement” with Topic tittle field,text message field,Attachment field and save button

Whenever I try to create new Announcement,

I enter something in topic title feild,text message feild,attached image in Attachment feild,and finally click the save button,its works properly then it automatically moves to next page

But My Issue is

By clicking the save button with out attaching any image in attachment feild,I Got the error in console tab - “POST XHR http://mydomain/api/v1/courses/1016/discussion_topics” along with “401(unauthorised)”

And In network tab-{“status”:“unauthorized”,“message”:“Invalid access token.”}

But it work properly few day I’m getting issue.I dont know How to solve??

pls refer this image