I am looking for ways to avoid creating an ec2 instance
in order to have a valid callback URL to perform the oauth handshake.
I plan to use Lambda
to connect to a remote API
, but I need to be able to get the token first, which is valid only for 6 hours.
Is there any way I can make the handshake via Lambda
functions?
I think Lambda
along with API Gateway
offer a good solution. API Gateway allows you to create a persistent, publicly accessible HTTP endpoint. You can define specific 'resources' that map HTTP methods to lambda function calls.
I'm not especially familiar with OAuth 2, but I'm imagining something like this: In API Gateway, define a resource '/callback' with a GET method that invokes your Lambda function.
Register the API Gateway endpoint as your application's callback URI, which would look something like this:
https://c1bql2cdxy.execute-api.us-east-1.amazonaws.com/callback
By doing so, the remote service will invoke your lambda function, which can then read the authorization token from the request and use it however needed, whether that involves 1) storing the token in a database for future use (and reuse) by other services, 2) directly invoking the services within the same Lambda function, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With