OAuth 2.0

What is OAuth:

It is a framework to facilitate delegated and controlled access on behalf of user. So basically, it is a protocol that allows a user to grant a given third-party web site or application access to the user’s protected resources, without necessarily revealing their long-term credentials or even their identity.

There are different flows in which OAuth delegates these accesses but before discussing this let us get acquainted with few of the terminologies.

  • Resource Owner: Entity that can grant access to a protected resource. Typically, this is the end-user.
  • Resource Server: Server hosting the protected resources. This is the API you want to access.
  • Client: Application requesting access to a protected resource on behalf of the Resource Owner.
  • Authorization Server: Server that authenticates the Resource Owner and issues access tokens after getting proper authorization. In this case, Auth0.

Pre-requisite – Client registration:

Before initiating the OAuth protocol flow for authorization, the client needs to register itself with the authorization server with following information-

  1. Client type: OAuth defines two client types, based on their ability to maintain the confidentiality of their client credentials – confidential and public.
  2. Redirection URI: Also called call-back URL to which user is redirected post authorization from auth server.
  3. Any other information required by the authorization server (e.g., application name, website, description, logo image, the acceptance of legal terms).

Client Authentication:

Post registration, Auth server issues the registered client

  1. Client identifier/Client_id: A unique string, encoded using the “application/x-www-form-urlencoded” encoding algorithm, representing the registration information provided by the client. It is public and unique identifier that represents the client.
  2. Client credential/Client_secret: A password, public/private key pair etc. It is used to authenticate the client when it raises request for Access token.

OAuth protocol endpoints:

The authorization process utilizes two authorization server endpoints-

  1. Authorization endpoint (auth server base uri + /authorizatin): used by the client to obtain authorization from the resource owner. The request contains a redirection url to which the auth server will redirect the user post successful resource-owner authentication along with an auth code.
  2. Token endpoint (auth server base uri + /token)- used by the client to exchange an authorization grant for an access token, typically with client authentication.

OAuth flows:

There are different ways, also called flows, using which OAuth provisions delegation of authorization. And this is governed by the term ‘grant types’. In OAuth, an authorization grant is an abstract term used to describe intermediate credentials that represent the

resource owner authorization. Several authorization grant types are defined to support a wide range of client types and user experiences as below-

1. Authorization code grant (grant_type=’code’):

A few points to note about this flow-

  • The exchange of authorization code is done through a front channel which is considered less secure, but the exchange of Access token usually happens through back channel. This also happens to be one of the benefits of this flow over others.
  • Resource owner’s user agent is typically a web browser.
  • Local state parameter: It is an opaque value used by the client to maintain state between the request and call-back. The authorization server includes this value when redirecting the user-agent back to the client. The parameter SHOULD be used for preventing cross-site request forgery
2. Implicit grant flow (grant_type=’token’):

This grant type differs from Authorization grant flow in skipping the step where Auth server sends Auth code to the client. It instead sends the Access token directly in the redirection URI fragment. The user-agent then requests web-hosted client resource which returns a web page, typically containing HTML and an embedded script capable of accessing the URI fragment retained by user-agent. User-agent then runs this script to extract the access token and return to the client.

3. Resource owner password credential grant (grant_type=’password’):

Here the access token is facilitated in 3 steps as below-

  • The request owner provides the client with its username and password
  • The client requests an access token from the authorization server’s token endpoint by including the credentials received from the resource owner. When making the request, the client authenticates
    with the authorization server.
  • The authorization server authenticates the client and validates the resource owner credentials, and if valid, issues an access token.
4. Client Credentials Grant (grant_type=’client_credentials’):

The client can request an access token using only its client credentials (or other supported means of authentication) when the client is requesting access to the protected resources under its control. The client credentials grant type MUST only be used by confidential clients. It has following 2 steps.

  • The client authenticates with the authorization server and requests an access token from the token endpoint.
  • The authorization server authenticates the client, and if valid, issues an access token.
5. Extension grant:

The client uses an extension grant type by specifying the grant type using an absolute URI (defined by the authorization server) as the value of the “grant_type” parameter of the token endpoint, and by adding any additional parameters necessary. Extension grant types are there to support additional clients or to provide a bridge between OAuth and other trust frameworks. Let’s discuss one such grant-type below-

JWT Bearer token grant: This grant type is used when the client wants to receive access tokens without transmitting sensitive information such as the client secret. This can also be used with trusted clients to gain access to user resources without user authorization. Below are the steps to use this OAuth flow: –

  1. Create a JWT token by signing it using client’s private key
  2. Send request to token end point of authentication server. Ex-

POST /token.oauth2 HTTP/1.1

     Host: https://www.googleapis.com/oauth2/v4

     Content-Type: application/x-www-form-urlencoded

     grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

     &assertion=<JWT token created in step A>

3. Extract the access token from response

136 thoughts on “OAuth 2.0”

  1. I love your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you? Plz reply as I’m looking to design my own blog and would like to know where u got this from. thank you

  2. 먹튀폴리스

    It’s not my first time to visit this site, i am
    visiting this website dailly and get good information from here daily.

  3. 용인출장마사지

    Hi colleagues, fastidious post and nice urging commented
    at this place, I am actually enjoying by these.

  4. 신촌출장안마

    I read this article completely regarding the resemblance
    of most up-to-date and preceding technologies, it’s remarkable article.

  5. 하남출장마사지

    It’s not my first time to visit this web site, i
    am browsing this web page dailly and obtain fastidious data from here everyday.

  6. 동탄출장안마

    If you desire to get much from this article then you have to apply these
    techniques to your won weblog.

  7. 김포출장마사지

    What i don’t realize is in reality how you’re
    now not actually much more smartly-favored than you might be now.
    You are very intelligent. You understand thus significantly in relation to this matter, produced
    me in my opinion consider it from a lot of varied angles.
    Its like men and women are not fascinated unless it’s one
    thing to do with Lady gaga! Your own stuffs great.
    All the time take care of it up!

  8. 송파출장마사지

    Hey there! Do you know if they make any plugins to help with Search Engine Optimization? I’m trying to get my blog to
    rank for some targeted keywords but I’m not seeing
    very good gains. If you know of any please share.
    Thank you!

  9. 성남출장마사지

    Good answers in return of this issue with solid arguments and describing the whole thing concerning that.

  10. 고양출장안마

    You should take part in a contest for one of the greatest websites on the net.
    I’m going to highly recommend this web site!

  11. 인천출장안마

    This is very interesting, You are a very skilled
    blogger. I have joined your rss feed and look forward to seeking more of your excellent post.
    Also, I have shared your site in my social networks!

  12. 금천구출장안마

    My brother recommended I might like this web site. He was entirely right.
    This post actually made my day. You cann’t imagine just how much time I had spent for this info!
    Thanks!

  13. 노원출장마사지

    This paragraph gives clear idea in favor of the new people of blogging, that
    actually how to do blogging and site-building.

  14. 중랑구출장마사지

    Hey there superb blog! Does running a blog such as this take a massive amount work?
    I’ve virtually no expertise in computer programming but I was hoping to start my own blog soon. Anyhow, if you have any
    suggestions or techniques for new blog owners please share.

    I know this is off topic nevertheless I just wanted to ask.

    Thanks!

  15. 노원출장마사지

    Nice post. I learn something totally new and challenging on websites
    I stumbleupon every day. It will always be helpful to read content from other writers and use
    something from their web sites.

  16. 성남출장마사지

    Hi there! I simply wish to offer you a huge thumbs up for your excellent information you have
    right here on this post. I will be coming back to your web site for more soon.

  17. 강남출장마사지

    Howdy! I could have sworn I’ve been to this site before
    but after browsing through some of the post I realized it’s new to
    me. Nonetheless, I’m definitely happy I found it and I’ll be bookmarking and
    checking back often!

  18. 후불제출장

    Aw, this was an exceptionally good post. Spending some time and actual effort to
    make a very good article… but what can I say… I hesitate a whole lot and don’t seem to get anything done.

  19. 노원출장안마

    It’s a pity you don’t have a donate button! I’d most certainly donate to this brilliant blog!
    I guess for now i’ll settle for book-marking and adding your RSS
    feed to my Google account. I look forward to
    fresh updates and will share this site with my
    Facebook group. Talk soon!

  20. 인천마사지

    Hi there! Would you mind if I share your blog with my myspace group?
    There’s a lot of folks that I think would really appreciate
    your content. Please let me know. Thanks

  21. 군포출장마사지

    I’m impressed, I have to admit. Rarely do I come across a blog that’s both educative and amusing, and let me
    tell you, you’ve hit the nail on the head. The problem is something that not enough
    folks are speaking intelligently about. I’m
    very happy I stumbled across this during
    my hunt for something regarding this.

  22. 신촌출장안마

    This post will help the internet users for creating new website or even a blog from start to end.

  23. 경기광주출장안마

    Hi there to all, how is everything, I think every one is getting more from this website, and
    your views are nice for new users.

  24. 선릉출장안마

    You should take part in a contest for one of the most useful websites on the
    web. I most certainly will highly recommend
    this site!

  25. 안양출장안마

    Hiya very cool blog!! Guy .. Excellent .. Amazing .. I will
    bookmark your website and take the feeds additionally?
    I am happy to find numerous helpful information right here within the post, we
    want work out extra strategies in this regard, thank you for sharing.
    . . . . .

  26. 의왕출장안마

    Howdy! I know this is somewhat off topic but I was wondering if you knew where I could find a captcha
    plugin for my comment form? I’m using the same blog platform as yours
    and I’m having difficulty finding one? Thanks
    a lot!

  27. 모텔출장마사지

    This is my first time go to see at here and i am truly impressed to read everthing at single place.

  28. 시흥출장안마

    I read this article completely on the topic of the comparison of most up-to-date
    and earlier technologies, it’s remarkable article.

  29. 잠실출장마사지

    Pretty nice post. I just stumbled upon your blog and wished to say that I’ve really enjoyed surfing around your blog posts.
    In any case I will be subscribing to your feed and I
    hope you write again soon!

  30. 성남출장안마

    Good day! I could have sworn I’ve visited this website before but after looking at many of the posts I realized it’s new to me.
    Anyhow, I’m definitely pleased I discovered it and I’ll be book-marking it and checking back often!

  31. 후불제출장

    Way cool! Some very valid points! I appreciate you
    writing this post and also the rest of the site is also really good.

  32. 안산출장안마

    I am really grateful to the holder of this site who has shared this enormous post at
    here.

  33. Yahaira Taber

    When I initially commented I appear to have clicked on the -Notify me when new comments are added- checkbox and from now on whenever a comment is added I get four emails with the same comment. Is there a way you are able to remove me from that service? Thanks.

  34. 부평출장안마

    I’ve read some good stuff here. Definitely price bookmarking for revisiting.
    I surprise how a lot effort you place to create this type
    of great informative site.

  35. 신촌출장안마

    I love it whenever people come together and share opinions.
    Great website, continue the good work!

  36. 신림동출장마사지

    I am really thankful to the holder of this web site
    who has shared this enormous paragraph at at this time.

  37. 신림출장마사지

    Hi there just wanted to give you a brief heads up and let you know a few of the pictures aren’t loading properly.
    I’m not sure why but I think its a linking issue.
    I’ve tried it in two different internet browsers and both show the same results.

  38. 분당출장안마

    Hi there to every single one, it’s genuinely a good
    for me to go to see this site, it contains helpful Information.

  39. Hey there! I could have sworn I’ve been to this website before but after checking through some
    of the post I realized it’s new to me. Nonetheless,
    I’m definitely delighted I found it and I’ll be bookmarking and checking back frequently!

  40. 서울출장안마

    Nice post. I learn something totally new and challenging on blogs I stumbleupon on a daily basis.
    It will always be helpful to read articles from other authors and practice a little something from
    their sites.

  41. 후불제출장

    Heya just wanted to give you a brief heads up and let you
    know a few of the images aren’t loading properly. I’m not sure why but I think its a linking issue.
    I’ve tried it in two different browsers and both show the same results.

  42. 고양출장마사지

    My spouse and I stumbled over here from a different
    web address and thought I might check things out. I like
    what I see so i am just following you. Look forward
    to looking into your web page for a second time.

  43. 화곡동출장마사지

    I really like what you guys are up too. This sort of clever
    work and exposure! Keep up the terrific works guys
    I’ve added you guys to my personal blogroll.

  44. 후불제출장

    Hello, Neat post. There is an issue together with your
    web site in internet explorer, would test this?

    IE still is the market chief and a big section of
    people will omit your fantastic writing because of this problem.

  45. 고양출장마사지

    This is very attention-grabbing, You’re an overly professional blogger.
    I’ve joined your feed and look ahead to seeking extra of your magnificent post.
    Also, I have shared your site in my social networks

  46. 강서구출장안마

    If some one desires expert view about running a blog afterward i advise
    him/her to pay a quick visit this webpage, Keep up the pleasant work.

  47. I used to be suggested this website by way of my cousin. I’m no longer certain whether or not this put up is written by means of him as no one else know such precise approximately my difficulty. You’re incredible! Thank you!

  48. Your style is so unique in comparison to other folks I’ve read stuff from. Thank you for posting when you’ve got the opportunity, Guess I’ll just bookmark this web site.

  49. This is the right webpage for anybody who hopes to find out about this topic. You understand a whole lot its almost hard to argue with you (not that I really will need to…HaHa). You definitely put a new spin on a topic which has been discussed for years. Wonderful stuff, just excellent.

  50. After looking over a number of the blog articles on your web site, I seriously like your way of writing a blog. I saved it to my bookmark webpage list and will be checking back soon. Take a look at my website too and tell me your opinion.

  51. An intriguing discussion is worth comment. There’s no doubt that that you should publish more about this issue, it might not be a taboo matter but typically people don’t talk about such subjects. To the next! Best wishes!

  52. Howdy very nice site!! Man .. Beautiful .. Wonderful .. I’ll bookmark your website and take the feeds additionally?I am happy to search out so many useful info right here in the submit, we’d like work out more techniques on this regard, thank you for sharing. . . . . .

  53. Nice post. I was checking continuously this blog and I am impressed! Extremely useful information particularly the last part 🙂 I care for such information much. I was seeking this certain information for a long time. Thank you and best of luck.

  54. I appreciate, cause I found exactly what I was looking for. You’ve ended my 4 day long hunt! God Bless you man. Have a nice day. Bye

  55. 인천출장마사지

    I was wondering if you ever thought of changing the layout of your site? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or two images. Maybe you could space it out better?

  56. raspberry pi 3

    Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! By the way, how could we communicate?

  57. One other issue is that if you are in a predicament where you do not have a cosigner then you may actually want to try to make use of all of your financial aid options. You can get many funds and other scholarship grants that will provide you with funds to support with school expenses. Many thanks for the post.

  58. Lizzie Demarinis

    Thank you for your post. I really enjoyed reading it, especially because it addressed my issue. It helped me a lot and I hope it will also help others.

  59. Thank you for your post. I really enjoyed reading it, especially because it addressed my issue. It helped me a lot and I hope it will help others too.

  60. joel jota fortuna

    Nice blog here! Also your site loads up very fast! What host are you using? Can I get your affiliate link to your host? I wish my website loaded up as quickly as yours lol

  61. Thanks for posting. I really enjoyed reading it, especially because it addressed my issue. It helped me a lot and I hope it will help others too.

  62. Thank you for posting this post. I found it extremely helpful because it explained what I was trying to say. I hope it can help others as well.

  63. It’s really a nice and helpful piece of info. I’m glad that you shared this useful info with us. Please keep us up to date like this. Thank you for sharing.

  64. Great post. I was checking continuously this blog and I’m impressed!Extremely helpful information specially the last part 🙂 I care for such information a lot.I was looking for this particular info for a long time.Thank you and good luck.

  65. These are in fact impressive ideas in regarding blogging.You have touched some nice factors here. Any way keep up wrinting.

  66. hi!,I love your writing very so much! share we be in contact extra about your article
    on AOL? I need an expert in this space to unravel my
    problem. May be that is you! Having a look ahead to see you.

  67. Hey there I am so delighted I found your site, I really found you by mistake, while I was researching on Aol for something else, Nonetheless
    I am here now and would just like to say thank you for a incredible post and a all round enjoyable blog (I also love the theme/design), I don’t have time to go through
    it all at the minute but I have book-marked it and also added your
    RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the
    great jo.

  68. Nice post. I learn something totally new and challenging on sites I stumbleupon on a daily basis.
    It’s always exciting to read content from other authors and use a
    little something from their web sites.

  69. After going over a handful of the blog posts on your website,
    I really appreciate your way of blogging. I bookmarked it to my bookmark site list and will be checking back soon. Take a look at my
    website as well and tell me how you feel.

  70. Pretty nice post. I just stumbled upon your blog and wanted to
    say that I have truly enjoyed surfing around your blog posts.
    In any case I’ll be subscribing to your feed and I hope you
    write again very soon!

Leave a Comment

Your email address will not be published. Required fields are marked *