Introduction
This article explains about implementing the OAuth2.0 authentication on the webMethods.io Integration flow service and workflow.
Audience
It is assumed that readers of this article know how to create integrations on webMethods.io.
Prerequisite
- Subscription for webMethods.io integration tenants
-
Sample workflow or flow service is already developed.
- Sample flow service or workflow is wrapped using API
Use Case
- We have created the webhook workflow
- Same workflow is wrapped under API and exposed to the outer world with new endpoints
- In our case we will implement the OAuth 2.0 mechanism on the API.
- When third-party application wants to access it, OAuth 2.0 mechanism will be used to authorization purpose.
What is OAuth2.0?
- OAuth is an open standard for access delegation, commonly used as a way for Internet users to grant websites or applications access to their information on other websites but without giving them the passwords
- For more information, you can follow below link
Steps to implement OAuth 2.0
Create OAuth Client
- Login to webMethods.io integration and from user icon from the right click on settings.
- Click on OAuth2.0
- From the Client registration tab click on Add new Client
- Provide the name for Client as CustomerRegistrationOAuthClient
- Under the client management provide the version, Type as “public”
- In our case we are going to submit the request using the postman client so redirection url will be https://oauth.pstmn.io/v1/callback
- Set Allowed grants as “Authorization Code Grant”
- Set Expiration interval as “Never Expires”
- Set refresh token as “Unlimited”
- Click Add.
- Now with this our OAuth client is ready.
Create Scope
- Click on Add New Scope
- Provide the name for the scope as CustomerRegistrationScope.
- Select the project and select the appropriate API from the option provided.
- In our case we want to select the CustomerRegistrationAPI and select the resource
5.Click on Add.
Associate Scope with OAuth Client
- Click on Client Registration
- Click on existing associate scope under the action
- Click on Add existing scope
- Select the scope created “CustomerRegistrationScope”
- With this we have completed the OAuth setup in Webmethods.io integration.
**Testing with postman **
- Gather the below information to invoke the request from postman
a. Client ID
b. Client Secret
c. API endpoints
d. Call back url
e. Authorization URl - We can get the above details from CustomerRegistrationOAuthClient
3.Get the access token
4.Click on Get Access token.
- Provide the grant access
- Access token is generated.
- Now use this token to send the request and get the response from API
- Trigger the request and you will get the response from your API which get authenticated with token passed .