Fix server oauth2 process flow & add index data init api.
Fix oauth2 redirect url.
Move action logics into single file.