How To Handle OAuth 2.0 In Rest Assured

Поделиться
HTML-код
  • Опубликовано: 27 янв 2025

Комментарии • 86

  • @chandandurlov
    @chandandurlov 2 года назад +3

    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

    • @Mukeshotwani
      @Mukeshotwani  2 года назад +3

      Awesome chandan I am really glad it worked.. I love treats 😎

  • @abdulnazer3136
    @abdulnazer3136 3 года назад

    Thanks, Mukesh for the simple walkthrough. It truly benefited me a lot!!!

  • @positivevibes1769
    @positivevibes1769 3 года назад +1

    Thank you so much for such a wonderful video. really enjoying it.

  • @chandanrao9856
    @chandanrao9856 4 года назад +1

    Thank you Mukesh, its working absolutely perfect.

  • @dnb1doddi19
    @dnb1doddi19 5 лет назад +1

    Great explanation, Mukesh. Thank You.

  • @vinitransubhe6794
    @vinitransubhe6794 2 года назад

    Thanks Mukesh! Your videos are really helpful to learn the automation.

  • @raviahuja8375
    @raviahuja8375 4 года назад +2

    Thank you so much for this tutorial. Works so well for me :)

  • @012dsaini
    @012dsaini 3 года назад

    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.

  • @TechTamizh
    @TechTamizh 4 года назад +2

    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?

    • @Mukeshotwani
      @Mukeshotwani  4 года назад +1

      Saran 400 is relate to client error..
      given()
      .header("first_name", "John")
      .header("last_name", "Watson")
      .get();

  • @sathya-enjoy_lifetothefullest
    @sathya-enjoy_lifetothefullest 5 лет назад +1

    Awesome mukesh!!

  • @AliHassan-ux9hi
    @AliHassan-ux9hi 5 лет назад +1

    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..

    • @Mukeshotwani
      @Mukeshotwani  5 лет назад +1

      Hi Ali, in soapui we have dropdown where we just add values and it will work.
      Main concept is same.

    • @AliHassan-ux9hi
      @AliHassan-ux9hi 5 лет назад

      Mukesh otwani thanks.. I got it.. Keep doing the great work..

  • @nevenacukucan1515
    @nevenacukucan1515 4 года назад +2

    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?

    • @Mukeshotwani
      @Mukeshotwani  4 года назад +1

      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

    • @nevenacukucan1515
      @nevenacukucan1515 4 года назад

      @@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.

    • @tomzi6582
      @tomzi6582 2 года назад

      @Nevena Did you find solution for your issuse?

  • @yemiolu9302
    @yemiolu9302 5 лет назад +1

    Hi Mukesh, thank you for the great videos.. Are these videos enough to master Rest Assured?

  • @jaspreetdhawan8171
    @jaspreetdhawan8171 3 года назад

    Thank you so much for sharing this knowledge Works so well for me :)

  • @vinothinik3405
    @vinothinik3405 4 года назад +1

    I need to automate OAUTH 2 in ready api tool...can you please suggest me which videos can explain it well...

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Hi Vinothini, in ready api just add oauth details like client id,secret, app id and secret

  • @priyaukale3129
    @priyaukale3129 3 года назад

    Hi Mukesh, Can we do the authorization filter for specific users on AD groups using oauth or rest assured?

  • @R511251
    @R511251 4 года назад +1

    hi Mukesh from Portugal
    is possible put the second block of code with start Response respose1...inside a method and pass it the token?

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      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.

    • @R511251
      @R511251 4 года назад +1

      @@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?

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Sure Raul here is the mail mukeshotwani@learn-automation.com please share code along with error screenshot or logs.

    • @bhavyasrichundru1875
      @bhavyasrichundru1875 3 года назад

      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?

  • @ParagOak
    @ParagOak 5 лет назад +1

    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?

    • @Mukeshotwani
      @Mukeshotwani  5 лет назад

      HI Parag checkout this post, I guess this covers the same medium.com/@aswathyn/awaitility-handling-async-wait-in-automation-5066e20a1d12

  • @achintyasett9621
    @achintyasett9621 3 года назад +1

    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

    • @Mukeshotwani
      @Mukeshotwani  3 года назад

      Thank you Achintya good idea will do that.

  • @theharshaankalgi
    @theharshaankalgi 4 года назад +1

    Working well, Thanks much

  • @sunnyneluballi2131
    @sunnyneluballi2131 4 года назад +1

    Hi Mukesh, Can you please make a similar for 'AUTH0' (not 0auth) authorization....

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Sure sunny, can you provide any sample api which I can use for videos?

  • @saleethmohd
    @saleethmohd 4 года назад

    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?

  • @raunaqt90
    @raunaqt90 4 года назад

    Amazing!! Thank you so much Mukesh.

  • @justytutka
    @justytutka 3 года назад +1

    Could you please share somewhere working code? I copy the example but I still have errors.

    • @Mukeshotwani
      @Mukeshotwani  3 года назад

      Hi, can you tell me what error you are getting?

  • @jainanup402
    @jainanup402 3 года назад

    How to handle same request if grantype is authorization code

  • @rituthakur8913
    @rituthakur8913 3 года назад

    Nice explanation. How to get access token with grant type as Authorization code, where we have a concept of callback url as well ?

  • @surbhidhamija8033
    @surbhidhamija8033 Год назад

    Hi mukesh,thanks for sharing. Can you please make a video on grant type -authorization code

  • @amruthapenigalapati5593
    @amruthapenigalapati5593 4 года назад +1

    Hi Mukesh,
    Can you please make a video on API Authentication using ApacheHTTPClient and thanks for making the videos it is so helpful.

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      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/

  • @gagangill8831
    @gagangill8831 4 года назад

    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.

  • @behindthemask4033
    @behindthemask4033 4 года назад

    Hi Mukesh
    Can you please explain the difference between oAuth1 and oAuth2

  • @MrPravinshetty
    @MrPravinshetty 4 года назад

    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

  • @nandkishorkusalkar9803
    @nandkishorkusalkar9803 4 года назад +1

    Thank you Mukesh, Can you make video how we can create hybrid framework with Api with cucumber and scribe java api.

    • @Mukeshotwani
      @Mukeshotwani  4 года назад +1

      Hey Nandkishor I have not published all videos for API testing with RestAssured, will try to publish soon.

    • @nandkishorkusalkar8498
      @nandkishorkusalkar8498 4 года назад

      @@Mukeshotwani eagerly waiting for videos ,Thank you Sir.

  • @keshavareddy2239
    @keshavareddy2239 3 года назад

    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.

  • @bhavyasrichundru1875
    @bhavyasrichundru1875 3 года назад

    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.

  • @bhar5739
    @bhar5739 4 года назад +1

    Hi Mukesh,
    Can you please make video on Testing API authentication using Bearer Token with RestAssured?

    • @Mukeshotwani
      @Mukeshotwani  4 года назад +1

      Sure I will do that. Do you have any sample application which has Bearer Token ?

    • @bhar5739
      @bhar5739 4 года назад

      @@Mukeshotwani No I don't have :(

  • @reddiranig8083
    @reddiranig8083 3 года назад

    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 ?

  • @t.poulayareddy1704
    @t.poulayareddy1704 5 лет назад +1

    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.

    • @Mukeshotwani
      @Mukeshotwani  5 лет назад

      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

  • @varunmalhotra9374
    @varunmalhotra9374 5 лет назад +1

    coop url is not working

    • @Mukeshotwani
      @Mukeshotwani  5 лет назад

      @Varrun its working for me.. please check again

    • @varunmalhotra9374
      @varunmalhotra9374 5 лет назад

      @@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?

  • @santhoshveluri4200
    @santhoshveluri4200 4 года назад

    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

    • @kunu1232
      @kunu1232 3 года назад

      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.

    • @abhishekpandey-je6lq
      @abhishekpandey-je6lq 3 года назад

      Even I'm stuck at this, Did you get any solution ?

  • @grandhim7672
    @grandhim7672 3 года назад +1

    Thanks

    • @Mukeshotwani
      @Mukeshotwani  3 года назад

      Welcome Grandhi.

    • @grandhim7672
      @grandhim7672 3 года назад

      @@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.