problem in getting authorization code

While making the GET call to https://api.codechef.com/oauth/authorize if the user is already logged in to codechef it opens https://www.codechef.com/ and shows the message ‘invalid authorization request’. If the user was not logged in before, it works fine. What is the problem here?

@priyanshi_, you can use this sample app for reference: https://github.com/miss-invincible/codechef-sample-app
If you still face some issue, please let us know.