[Bug]: Re-authorization issue in datasource
Is there an existing issue for this?
- [X] I have searched the existing issues
Description
I have created a datasource with Authentication Type: Oauth 2.0 and Grant type : Authorization code, and saved the datasource in my app. When I tried to run a graph API ( https://graph.microsoft.com/v1.0/teams/{{teamsid}}/channels/{{channelid}}/messages ) using this datasource, it failed because access token was expired within 1 hour. So I need to re-authorize datasource in every hour to run the API. I need to know that how to re-authorize without coming to datasource.
Steps To Reproduce
- Create new datasource (Autheniticated API) with Authentication Type: Oauth 2.0 and Grant type : Authorization code
- Create an API using this datasource.
- API run without any error initially. But after every hour, access token was expired and we need to re-authorize datasource to fix the error.
Public Sample App
No response
Version
Appsmith v1.7.8
@SreelakshmiV12 could you please point us in the direction of the documentation for this API?
https://docs.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-1.0&tabs=http - This is the API documentation. This API is used to send messages to teams through appsmith.
Hey @SreelakshmiV12 ! Do you think you can share a screenshot of the way your datasource is configured? Please make sure to hide any sensitive data in the screenshot before you post it here. :)
@nidhi-nair I can share screenshots.
Everythig works well.
I can configure google analytics, fetch data, process them, combine with other data, no need extra scripts and re-input data for OAuth2 authification, system can do it by itself ............ everything is fine.
But one big trouble exists that has bad effect on production using - system can not re-autorize expired oauth token for datasource automaticly, need press button save and autorize.
We use the latest version of appsmith, updating once per week, now its version 1.8.15.
ps. Maybe I configured something wrong? Or some hack exists for emulate this re-authorize, forcing it? (I tried call screen2 button url in rest api - but unauthorized in appsmith, not easy way)?
screen 1:

screen 2:

screen 3:

Hey @SKovbel ! There's a guide in our documentation for Google Sheets that might help you out here. Google uses the following two custom parameters to make sure that tokens are refreshed automatically without needing a user to authorize it.
prompt: consent
access_type: offline
cc: @rohan-arthur @pranavkanade
@nidhi-nair Yes, it works, whole day without re-auithorize. Thanks a lot.