One suggestion, before implementing, if you please describe what is the logic of auth 1.0 and auth 2.0 that will be very helpful. Apart from that content is very helpful.
Thank you so much for your tutorial..you have mentioned only about bearer token and url in this code...but in my case i need to provide header section and body section available..when i tried i was getting 400 error code..how to give header section and body section?
Hi Mukesh, are going to make video on Oauth2.0 handling in soapUI soon? Or if u already have made it can u send the link. I couldn’t find it on RUclips.. thanks for the work u doing..
Hi Mukesh, nice video!I am trying to automate OAuth2 authorization process for Spotify API using REST Assured - have you had any experience with that?The flow you have shown in this video is one of the three different flows for getting authorized on Spotify and it is also called Client Credentials. This approach, however, gives read-only access to user account. To get a full user authorization, I need to use Authorization flow and this is where things get tricky. The flow requires: getting an authorization code, exchanging that code for an access token and refreshing the access token after it expires. The part that I still have not solved it getting an authorization code, because on this step it is expected that user clicks a button in a browser. Another difference from the example you presented is that redirect Uri is mandatory form parameter for a request.Would you consider creating a video that covers this example?
Hi Nevena, this use-case (Spotify) looks very interesting and I will try to cover this scenario in my next video. In this mean while you can check this video which might help ruclips.net/video/yAXoOolPvjU/видео.html
@@Mukeshotwani That sounds great, thank you! And thanks for the recommendation - I watched the API University video a couple of days ago, however it didn't provide answers to my dilemmas. I'll make sure to watch it more patiently and I am looking forward to your new video! P.S. I tried to surpass the step when user gives authorization in browser with using Selenium. Instead of using RestAssured to send a GET request, I open the same URL in browser; Selenium enters credentials, logs in; webdriver gets the URL and extracts the authentication code from it. For now, this solution doesn't work, but I plan to continue troubleshooting it. If there is a Java class or library that you would recommend instead of Selenium for this (1st) part of the authorization flow, please do let me know.
Hey Raul yes it is possible you can store the response and token variable as global variable and use the same in next method. Just for demo purposes I have used 2 method one for valid and one for invalid.
@@Mukeshotwani i tried to did that and the variable wich i take came null...do have email to send theprint and talk a little more?if you want help me or can do from here?
Hi Raul, I have the same doubt. Can you please help me how to do it. I'm struck there how to store them in global variables and use in next metho or in other class?
Hi need a help for "how to handle async calls in rest assured" I have a project where post API sends req to couchdb which creates random id. how to validate post status codes for random IDs?
Hi Mukesh, Its a great video to learn! Thanks for putting so much effort on this. Can you please also upload a video on OAUTH2 based on third-party authorization (e.g. accessing Instagram via Google login)? It will be really helpful! Thanks & Regards, Achintya Sett
H Mukesh, Can we run OAuth 2.0 related test case parallel? Since once a token is generated the previous token will expire right. So how we will run tests parallel?
Yes, sure Amrutha I had only one post and one video on this. Will try to make series on this too but RestAssured internally uses the same lib. learn-automation.com/how-to-perform-web-services-testing-using-httpclient/
mukesh, there is an access token appearing in api response. it expires after every 1 hour. How can i use the access token so that i do not have to change the token over and over again.
I am getting error Please help ":"unsupported_grant_type","error_description":"Grant type \u0022client-credentials\u0022 not supported and through postman getting { "error": "invalid_request", "error_description": "The grant type was not specified in the request" } error
im getting below error for token access request, { "error": "invalid_request", "error_description": "The grant type was not specified in the request" } could you please help me on this? Thanks.
Hi Sir, Please explain, how to keep this automation code for auth2.0 in one class and to be called directly in other class. so that we reduce coding in a single class.
Hi Sir, Thank you for this great tutorial. What should be the value of parameter code in case if we are using grant-type as Authorization code ? I'm getting the below error on sending the request as public void getAuthCode() {
Response resp = RestAssured.given() .formParam("grant_type", "authorization_code") .formParam("client_id", "xx") .formParam("client_secret", "xyz") .formParam("redirect_uri", "url") .post("${base_uri}/token"); System.out.println(resp.getStatusCode()); System.out.println(resp.asString()); } 400 {"error":"invalid_request","error_description":"Missing parameter: code"} Can you please help me sir ?
Hi Mukesh, Can you please help me with outlook (office 365) login and read mails. I'm not sure from where will get the details to do API call request. I need your suggestion. Thanks in advance.
Hi Mukesh.. Thank you soo much for the video. Please help me out how to send client SSL certificates like .pem, .key file as part of post request while generating the access token. I got stuck in my project.. Please help me with the code
Hi Santhosh, Are you able to fix this. Even I am struggling for this since couple of weeks. can you please help if you have the code. Thanking you in Advance.
@@Mukeshotwani Thank you so much. your lecture is very clear and helpful. i am new to Rest Assured. but after watching video once, then and there i am able to write code. Many thanks and looking forward for your videos.
Thanks a lot Mukesh Sir, this solution worked for me....you made my day, If I meet you in person then surely I will give you a treat
Awesome chandan I am really glad it worked.. I love treats 😎
Thanks, Mukesh for the simple walkthrough. It truly benefited me a lot!!!
Thank you so much for such a wonderful video. really enjoying it.
Thank you Mukesh, its working absolutely perfect.
Awesome Chandan
Great explanation, Mukesh. Thank You.
Thanks Mate
Thanks Mukesh! Your videos are really helpful to learn the automation.
Thank you so much for this tutorial. Works so well for me :)
awesome Ravi..
One suggestion, before implementing, if you please describe what is the logic of auth 1.0 and auth 2.0 that will be very helpful. Apart from that content is very helpful.
Thank you so much for your tutorial..you have mentioned only about bearer token and url in this code...but in my case i need to provide header section and body section available..when i tried i was getting 400 error code..how to give header section and body section?
Saran 400 is relate to client error..
given()
.header("first_name", "John")
.header("last_name", "Watson")
.get();
Awesome mukesh!!
Thanks Satya
Hi Mukesh, are going to make video on Oauth2.0 handling in soapUI soon? Or if u already have made it can u send the link. I couldn’t find it on RUclips.. thanks for the work u doing..
Hi Ali, in soapui we have dropdown where we just add values and it will work.
Main concept is same.
Mukesh otwani thanks.. I got it.. Keep doing the great work..
Hi Mukesh, nice video!I am trying to automate OAuth2 authorization process for Spotify API using REST Assured - have you had any experience with that?The flow you have shown in this video is one of the three different flows for getting authorized on Spotify and it is also called Client Credentials. This approach, however, gives read-only access to user account. To get a full user authorization, I need to use Authorization flow and this is where things get tricky. The flow requires: getting an authorization code, exchanging that code for an access token and refreshing the access token after it expires. The part that I still have not solved it getting an authorization code, because on this step it is expected that user clicks a button in a browser. Another difference from the example you presented is that redirect Uri is mandatory form parameter for a request.Would you consider creating a video that covers this example?
Hi Nevena, this use-case (Spotify) looks very interesting and I will try to cover this scenario in my next video. In this mean while you can check this video which might help ruclips.net/video/yAXoOolPvjU/видео.html
@@Mukeshotwani That sounds great, thank you! And thanks for the recommendation - I watched the API University video a couple of days ago, however it didn't provide answers to my dilemmas. I'll make sure to watch it more patiently and I am looking forward to your new video!
P.S. I tried to surpass the step when user gives authorization in browser with using Selenium. Instead of using RestAssured to send a GET request, I open the same URL in browser; Selenium enters credentials, logs in; webdriver gets the URL and extracts the authentication code from it. For now, this solution doesn't work, but I plan to continue troubleshooting it.
If there is a Java class or library that you would recommend instead of Selenium for this (1st) part of the authorization flow, please do let me know.
@Nevena Did you find solution for your issuse?
Hi Mukesh, thank you for the great videos.. Are these videos enough to master Rest Assured?
After few more videos yes.
Thank you so much for sharing this knowledge Works so well for me :)
I need to automate OAUTH 2 in ready api tool...can you please suggest me which videos can explain it well...
Hi Vinothini, in ready api just add oauth details like client id,secret, app id and secret
Hi Mukesh, Can we do the authorization filter for specific users on AD groups using oauth or rest assured?
hi Mukesh from Portugal
is possible put the second block of code with start Response respose1...inside a method and pass it the token?
Hey Raul yes it is possible you can store the response and token variable as global variable and use the same in next method.
Just for demo purposes I have used 2 method one for valid and one for invalid.
@@Mukeshotwani
i tried to did that and the variable wich i take came null...do have email to send theprint and talk a little more?if you want help me or can do from here?
Sure Raul here is the mail mukeshotwani@learn-automation.com please share code along with error screenshot or logs.
Hi Raul,
I have the same doubt. Can you please help me how to do it. I'm struck there how to store them in global variables and use in next metho or in other class?
Hi need a help for "how to handle async calls in rest assured"
I have a project where post API sends req to couchdb which creates random id. how to validate post status codes for random IDs?
HI Parag checkout this post, I guess this covers the same medium.com/@aswathyn/awaitility-handling-async-wait-in-automation-5066e20a1d12
Hi Mukesh,
Its a great video to learn! Thanks for putting so much effort on this.
Can you please also upload a video on OAUTH2 based on third-party authorization (e.g. accessing Instagram via Google login)?
It will be really helpful!
Thanks & Regards,
Achintya Sett
Thank you Achintya good idea will do that.
Working well, Thanks much
You're welcome! Harsha
Hi Mukesh, Can you please make a similar for 'AUTH0' (not 0auth) authorization....
Sure sunny, can you provide any sample api which I can use for videos?
H Mukesh, Can we run OAuth 2.0 related test case parallel? Since once a token is generated the previous token will expire right. So how we will run tests parallel?
Amazing!! Thank you so much Mukesh.
Thanks Raunaq
Could you please share somewhere working code? I copy the example but I still have errors.
Hi, can you tell me what error you are getting?
How to handle same request if grantype is authorization code
Nice explanation. How to get access token with grant type as Authorization code, where we have a concept of callback url as well ?
Mukesh could you please make this video also
Hi mukesh,thanks for sharing. Can you please make a video on grant type -authorization code
Hi Mukesh,
Can you please make a video on API Authentication using ApacheHTTPClient and thanks for making the videos it is so helpful.
Yes, sure Amrutha I had only one post and one video on this. Will try to make series on this too but RestAssured internally uses the same lib.
learn-automation.com/how-to-perform-web-services-testing-using-httpclient/
mukesh, there is an access token appearing in api response. it expires after every 1 hour. How can i use the access token so that i do not have to change the token over and over again.
Hi Mukesh
Can you please explain the difference between oAuth1 and oAuth2
I am getting error Please help ":"unsupported_grant_type","error_description":"Grant type \u0022client-credentials\u0022 not supported and through postman getting {
"error": "invalid_request",
"error_description": "The grant type was not specified in the request"
} error
Thank you Mukesh, Can you make video how we can create hybrid framework with Api with cucumber and scribe java api.
Hey Nandkishor I have not published all videos for API testing with RestAssured, will try to publish soon.
@@Mukeshotwani eagerly waiting for videos ,Thank you Sir.
im getting below error for token access request,
{
"error": "invalid_request",
"error_description": "The grant type was not specified in the request"
}
could you please help me on this? Thanks.
Hi Sir,
Please explain, how to keep this automation code for auth2.0 in one class and to be called directly in other class. so that we reduce coding in a single class.
Hi Mukesh,
Can you please make video on Testing API authentication using Bearer Token with RestAssured?
Sure I will do that. Do you have any sample application which has Bearer Token ?
@@Mukeshotwani No I don't have :(
Hi Sir, Thank you for this great tutorial.
What should be the value of parameter code in case if we are using grant-type as Authorization code ?
I'm getting the below error on sending the request as
public void getAuthCode() {
Response resp = RestAssured.given()
.formParam("grant_type", "authorization_code")
.formParam("client_id", "xx")
.formParam("client_secret", "xyz")
.formParam("redirect_uri", "url")
.post("${base_uri}/token");
System.out.println(resp.getStatusCode());
System.out.println(resp.asString());
}
400
{"error":"invalid_request","error_description":"Missing parameter: code"}
Can you please help me sir ?
Hi Mukesh, Can you please help me with outlook (office 365) login and read mails. I'm not sure from where will get the details to do API call request. I need your suggestion. Thanks in advance.
Hi Poulaya, you can get all api's from here docs.microsoft.com/en-us/previous-versions/office/office-365-api/api/version-2.0/mail-rest-operations
coop url is not working
@Varrun its working for me.. please check again
@@Mukeshotwani done, need help like what to use protractor or selenium for automating web app which is currently on angular and being moved to react?
Hi Mukesh.. Thank you soo much for the video. Please help me out how to send client SSL certificates like .pem, .key file as part of post request while generating the access token. I got stuck in my project.. Please help me with the code
Hi Santhosh,
Are you able to fix this. Even I am struggling for this since couple of weeks. can you please help if you have the code. Thanking you in Advance.
Even I'm stuck at this, Did you get any solution ?
Thanks
Welcome Grandhi.
@@Mukeshotwani Thank you so much. your lecture is very clear and helpful. i am new to Rest Assured. but after watching video once, then and there i am able to write code. Many thanks and looking forward for your videos.