I am currently developing an Angular application that utilizes the implicit grant oauth strategy. In case I do not have a valid access token in my cookies, I am redirected to the web interface of the authentication server where I input my credentials and then get redirected back to my site with the access token included in the URL. My system then parses this token and stores it in the cookies.
Now, I am faced with the challenge of unit testing this parse function that extracts the access token from the authentication server. Seeking advice on the best approach, thus posting my query here:
1. How should I go about unit testing (without making direct requests to a live oauth server) a function that parses the access token?
2. What is the best practice for constructing URL parameters with the access token? Is it secure to use the current access token for testing purposes?
3. Are there any libraries available that can assist in creating mock access token objects?