Please ensure you are entering the correct API key without any extra spaces. You might find this similar discussion helpful. Additionally, note that it is not necessary to generate a request token and access token every time. Once you have an access token, you can save and use it for the entire day. For more details, please refer to the documentation.
There is no extra spaces and i have already double checked the documentation. Still facing the Invalid API Key error, what can i do now ? Create a new application to get new API Key ?
If still unsure, you may enable debug logs and send the complete stacktrace in private message.