More reliable oauth grant submit
Moved oauthgrant js into separate file. Untested.