Reputation: 325
I have a task which need to call an external Oauth2 API to get data.
The authentication steps of this API is:
https://api.apiname/v1/oauth?app_id= [value] & redirect_url = [value] & response_type = [value] & scope = [value] & state = [value]
-> It will redirect to the login page of this API
https://api.apiname/v1/token?grant_type=oauth_code&app_id=[value]&secret=[value]&code=[value]
So how can I get through step 1,2,3 automatically in my system because the client should not have to log in to API to get the code? Is there a way I can go through step 1 without showing login page?
Upvotes: 0
Views: 1160
Reputation: 2804
I think the main purpose of Authorization code grant type in OAuth2 is to use a 3rd party login without having to save the user credentials in our app.
"Is there a way I can go through step 1 without showing login page?"
:
If you do this, this is in a way just client credential flow. I am not an expert, but I think this is technically possible using a chrome/firefox driver filling up the data for you using web scraping. But think twice before you use it since you are overriding the whole purpose of AuthCode grant type.
refer : Securing an existing API with our own solution
Upvotes: 2