Standard pattern for Outh2.0 Authorisation Flow

Seeing as you guys are so helpful, I thought I’d post on here before I spend a load more time getting this to work!

I need to authenticate with a 3rd party via OAuth2.0 and extract data from their API… they don’t have python library but I was hoping to use requests to get the data. However I need to build an OAuth2.0 flow to authenticate.

The actual API is here, however I’m sure the pattern is the same for many different APIs. I have a client_id and client_secret from the 3rd party (plus the ability to authorise redirect urls), and I was planning on using Requests-OAuthlib to build the flow. I thought I’d check in to see if there is any Anvil magic which will make my life easier, or any template patterns I could use as a starting point.

Thanks in advance!

Searching Anvil Docs for “OAuth” turns up quite a few topics, the first one being a link to an example that may be helpful.

1 Like

@jim how is this going? This was a very timely question as I was in the process of building a similar workflow. @p.colbert suggested link is super useful for an anvil style oauth flow… note that the example app that comes up in the docs is also here:

https://anvil.works/ide#clone:66LKEE352KMYRSFK=CHSYOOSMI5UNCBXTKIWXU4Q6

where you see the use of the request library you can also use the anvil.http library which is similar but may be preferable.

Thanks Stu, given the pandemic situation priorities have shifted around so not progressed this, hopefully if/when the world calms down a little I’ll update! Stay safe and well people…

1 Like