Is there any way oauth login with responded ID?

I’m making small service using oauth.

I found several components use oauth.
However, all of example use static client ID (already written in file or script)

I wanna get client ID, password from text_input.

Only the problem is ‘redirect’
After I take oauth ‘token’ with recived ID, Password, the server immediately redirect to original url.
Then, they lost session_state’s information.

I’m thinking pass ID, password to browser cookie.
or using 2 server, redirect with token to another url and transfer.
Are there any better ways?