<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Daniel Okoronkwo on Medium]]></title>
        <description><![CDATA[Stories by Daniel Okoronkwo on Medium]]></description>
        <link>https://medium.com/@danielokoronkwo?source=rss-b6a4a00ca2d7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*x38_-0E37SXoBXrVbbfKMw@2x.jpeg</url>
            <title>Stories by Daniel Okoronkwo on Medium</title>
            <link>https://medium.com/@danielokoronkwo?source=rss-b6a4a00ca2d7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 04:05:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@danielokoronkwo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[One Year Older, One Year Wiser]]></title>
            <link>https://danielokoronkwo.medium.com/one-year-older-one-year-wiser-997ae3a63a8d?source=rss-b6a4a00ca2d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/997ae3a63a8d</guid>
            <category><![CDATA[geopolitics]]></category>
            <category><![CDATA[religion]]></category>
            <category><![CDATA[love]]></category>
            <category><![CDATA[family]]></category>
            <category><![CDATA[birthday]]></category>
            <dc:creator><![CDATA[Daniel Okoronkwo]]></dc:creator>
            <pubDate>Wed, 02 Sep 2026 03:18:09 GMT</pubDate>
            <atom:updated>2026-09-02T03:20:29.846Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YBY9HOd2i9arsVKS5JDCEQ.png" /></figure><p>I have not written an official article for the past 2 months, 3 months by the time I hit publish on this article. If you are wondering how that is possible given that my last Medium article has a different date, it is because I write most <strong>non-technical</strong> articles here(on Medium). For my technical and <strong>tech related</strong> articles go <a href="https://www.danielokoronkwo.com/">here</a></p><p>I started writing this peice exactly 6 days to my birthday. I started writing because there are a lot of thoughts in my mind that I truly believe the world will benefit greatly from. Many of these thoughts are not even related. These thoughts cut across family, religion, the world, career, technology, the world hierarchy, family again, geography, government, doubt, fear, pressure, discipline, motivation, love, the world again and the systems of the world.</p><h3>On Family</h3><p>I remember one of the days in secondary school when myself and 2 of my friends Sampson and Michael were walking down to Michael’s house after school and we were randomly discussing about many things including life after school, structure of our families etc.</p><p>This would probably be the 754th time we would be having such conversation(who was keeping count anyway). I remember this particular day because Sampson made such a profound statement that remained with me even though I did not understand the implication of that statement.</p><p>Sampson said</p><blockquote>“You guys do not even understand yet the implication of the position you occupy in your families”.</blockquote><p>He was referring to me and Michael.</p><p>There is a back story to this though. Before now, we have discussed Sampson’s family structure and how it may have contributed to him being able to achieve his goal of being a footballer.</p><p>Years later, I look at my life and family, I realise that the statement Sampson made was super powerful.</p><p>For a very long time, before my mum died we lived a relatively modest life. My mum is the most beautiful woman you will ever meet. A hustler and a mother who loved with all her might. Back then, while I wasn’t sure of it based on my environment, I knew there was “better” out there.</p><p>All I needed to do was continue to be excellent in academics and the rest will sort itself out. How it would happen, I was not sure of it, but I would constantly promise my mum heaven on earth(don’t ask me why not my dad). I even promised to place my mum on salary once I “make it”. Silly me thought my parents were <strong>immortal</strong>. Anyways, its been exactly 3<strong>,584 days (or about 9 years and 10 months) </strong>since she died and I still randomly remember what her face looked like and some of our banter.</p><p>A specific memory I always go back to was when she asked me to go stay at the shop on a Sunday when we had already concluded that we will no longer be opening on Sunday. I was so happy when the Sunday decision was made because it meant, Iwould finally be able to catch up with “friends”. I was not happy when she told me that. I even tried negotiating my way out of that situation.</p><p>I went to open the shop anyways. But I think about that memory because I would give anything to have her be around while I stay at the shop. She doesn’t have to even be there. I would be there all by myself.</p><p>I told the story above to let you know that every thing that have happened to me in the area of family can be pointed back to my mum’s death. The drive did not end but it made the journey a lot different.</p><p>I became more intentional with my relationships with family(Nuclear and Extended). I occupy a very delicate position in my nuclear and extended family both from my maternal and paternal side.</p><p>I am the big brother in the middle who orchestrates the choir. I am like a Director in a movie except the movie is my family life.</p><p>This means that I have to perform my duties in every angle and corner you can imagine. I have to advice (education, career choice, relationship). There are situations that plenty talk would not help with, but some financial help will go a long way. There are situation where maintaining an appreciative demeanor and removing any atom of entitlement will be greatly useful. This occurs especially when dealing with older family members.</p><p>I am definitely not the best(&lt;insert whatever&gt;) to everyone in my family members. But I have learnt one thing that matters the most.</p><p>You have to meet everyone at their level. Assume the best intention from everyone. Approach everyone with grace. Most importantly <strong>Love </strong>and<strong> Cherish </strong>everyone deeply and treat them exactly the way you want to be treated.</p><h3>On Love</h3><p>Love is an interesting concept or feeling depending on how you view it. For people who know me on a personal level, it is no doubt that I am in a relationship with the <strong>second</strong> <strong>most beautiful woman in the world.</strong> Second only to my mum. I guess it is okay to say the most beautiful woman in the world now, given that my mum is late.</p><p>At the beginning and like most things, you try to understand each other’s “love language”. What I personally realised is this:</p><blockquote>There is no greater love language than the one God gave us through His son Jesus Christ.</blockquote><p>Would you be willing to continue loving someone even when it is clear to everyone out there that such person is a terrible person especially according to the law(world standard).</p><p>This is not just a “relationship” thing. It trickles down to family and the world at large.</p><p>Let’s talk family first.</p><p>What would you do when your only sister who you have been warning, advicing about the dangers of pre-marital sex becomes pregnant?</p><p>Would you throw her out of the house? Forcefully ask her to marry the father of the baby to cover the shame? Threaten the boy? or do some harm to the boy?</p><p>What happens if your brother gets involved with a gang despite all the advice you have given him? Do you stop loving him? Do you disown him?</p><p>What happens when a relative borrows money from you, refuses to payback and seems nonchalant when it comes to paying. Do you disown them? distance yourself from the? vow to never help them ever again?</p><p>For the outside world</p><p>What happens when your male friend gets a girl pregnant? Do you hate them for life or do you correct in love?</p><p>When you see the beggars on the street, do you threaten to harm them or you speak to them with love?</p><p>When you see that person with terminal disease on the road or online, do you say “what if it is a scam?”, “why is everyone always sick?”</p><p>There is an obvious question I have refused to ask here because “redpill” people will try to justify their cruelty and I would not give them such opportunity.</p><p>What I am saying is this:</p><p>Loving people and doing so unconditonally is freaking hard. A lot of individuals out there will try to tell you that a certain gender loves unconditionally and one doesn’t. I want to submit to you today that loving a person is freaking hard. You have to tolerate their excesses. You have to care for them. You have to sometimes think for them. You have to correct them(of course in love). You have to sometimes ignore them for sometime.</p><p>Jesus Christ did it for us. Which means it is not impossible to do it as a human being. Just like everything in life, you just have to choose to love people wholeheartedly. Sometimes you feel sympathy for them and you wish you can solve all their problems. Most times you can’t and that’s fine.</p><p>But Love is a gift inside you that you can always freely give. It doesn’t cost you money.</p><p>As a sign of love, I have resorted to giving some gift items to some very special people who live amongst us. If you ever meet me in person, ask me about it. I would be more than happy to give you the full details. I also hope to make this to a reccurrent thing.</p><h3>On Career</h3><p>I started this craft because I love automating things and I loved the sound of “robotics engineering”. A friend introduced me to coding and since then I have been grinding my way through different phases of my career.</p><p>I have navigated learning, deviating from the initial path that lured me into technology, being confused, self-doubt, confidence and continuous development.</p><p>The past 2 years have been the most interesting because I finally gained an incredible amount clarity on how I want to navigate the rest of my career. I realised more than anything what was possible in the world of tech. I also realised that maybe I have been swimming at the surface level of this career path. This realisation is because I have move past the stage where I complete tasks to owning systems, building from scratch and design thinking.</p><p>I have worked on distributed systems in collaboration with other engineers and ones that I have setup myself. I also started thinkering with low-level systems engineering. I have read more technical books and papers this year alone more than I have read in the first 5 years of my career.</p><p>The biggest jump and difference in my knowledge has been due to the books and papers that I have read. When I noticed this, I thought to myself “why didn’t I start this earlier?” The answer is super simple, because I wouldn’t have understood certain concepts and ideas that were mentioned in some of the books and papers I have read no matter how hard I tried. That is why the one advice I will give to early career professionals in the field of technology or software engineering is:</p><blockquote>Do the thing</blockquote><p>Leave the roadmap. Leave the planning and resource gathering. Just do the thing. You will be confused, you will not understand it deeply enough to participate in certain kinds of conversations especially conversations about low-level details of the concept or tools but I can assure you that doing the thing, seeing where it fails, not understanding the full details on why it fails but recognising failure patterns will help you greatly when you finally go searching for knowledge on the “under-the-hood” design details.</p><p>Another insight I have to share with you is this:</p><blockquote>In the early days of your career, look out for opportunities to own outcomes not just complete tasks</blockquote><p>This particular one is probably the mostly crucial one. This can backfire sometimes especially when you join a new organisation where everyone benefits greatly from a slow bureaucratic process. You will be seen as being too earger and a threat to be people who benefit from the bureacracy. I am not here to tell you how to navigate the part of being a threat to those people. I am only interested in letting you understand that you have to be a little selfish. Owning outcomes helps you in many ways:</p><ol><li>Your CV looks better because it follows the recruiter recommended way of writing bullet points.</li><li>You have extra context beyond just the technical knowledge. You have business and product context.</li><li>You become a resource person in your present organisation which makes you somewhat indispensable.</li></ol><p>Point 3 may backfire because you could become people’s dumping ground for tasks that involves your knowledge. I would leave navigating this part to you.</p><p>One way to deal with organisations where the bureacracy is crippling your growth as a person is to just leave the place. If more people benefit from it and you trying to be different is crippling your growth, please get out of there. Of course, there are nuances to consider but just do what’s best for you because in the end, the organisation is incentivised to do what’s best for them and you can always borrow a page from them.</p><h3>On Religion</h3><p>This maybe the most controversial one. Every day, people debate religion. Is there a supreme being. Some people on different social media platforms have built an entire influencing career off discussing religion whether it is for or against.</p><p>Here is my submission and observation.</p><blockquote>Human beings are inherently selfish and lazy.</blockquote><p>You may disagree, you may look at your life and talk about all the times you have been a “good” person. All that would not matter because deep down in those moments where you were a “good” person, there was a high percentage of self that motivated the action.</p><p>It could be so that you want to look good in the eye of people</p><p>It could because you do not care what people’s opinion about you is.</p><p>It could be because you like a person and would do anything including hurting other people to make them happy.</p><p>There is always an element of self.</p><p>I am not an expert in religious studies, a theologian or a philospher but the reason why I refuse to debate the spirituality and existence of God with certain people is because their argument is never consistent.</p><p>Most argue that we have to follow logic at all times but when it does not favour their argument or their attempt to ridicule people who believe in God, they start deviating from their original thoughts and submission.</p><p>Some say, the Christain religion(which I belong to) and the Holy Bible is white man packaged historical text to enslave the black African. My question is, how many of your supposed physics or chemistry textbook can pass the same argument. You can’t choose to use one book as a reference point to back your argument and then throw the other away when I use your logic on it too.</p><p>You can argue about the ambiguity of a supreme being but if you cannot consistently explain how everything is perfectly placed across the universe. The solar systems, the moon and stars, the birthing process, the digestion process and the fact that everything including certain inconveniences are perfectly accounted for, then you have to acknowledge the existence of a “forever being”. The forever being has to be God.</p><p>Here is what I want you to know. No matter how much your bash a general overseer or how much you h*ate an african Christian, God is still God. You can argue that certain people leave their human resposibilities to God which leads to lower human capital development but it has nothing to do with God. It is just the lazy and selfish way of life human beings including people in government exibit which can be fixed with better teaching, community development and national orientation.</p><p>What I am saying in essence is, there is a supreme being, you already believe. The fact that we argue means that you already acknowledge the existence of a supreme being. The fact that people have built entire career studying the designs and the creation of that supreme being further lay claim to the existence of a supreme being.</p><p>You already believe in something. I am just arguing that you are too selfish and many times illogical as a person to believe in yourself alone.</p><p>This brings me to the next point.</p><h3>On Politics</h3><p>I will be speaking mainly on Geopolitics. Earlier this year, the buzz word was “the strait of hormuz”.</p><p>Many “informed” people who were apparently geopolitical experts started calling out other people. They made denigrating remarks about other people. Sometimes because they were totally ignorant, sometime because they took the “wrong” side.</p><p>My view is simple, the world is functioning exactly as it is designed to. Do we really have to concern oursleves or exert out efforts on every topic in life. Where do we draw the line in our quest to acquire knowledg?</p><p>I already established the selfishness of humans and how ego plays a great part in the world system which means that everyone including nations will act in their best interest no matter what burns in the process. Now that we know that, what can you do when you are not close to the seat to effect change? What’s to say you will do any different when you get to that seat?</p><p>Do you get the idea now? People including nations will do things in their best interest. Where you can, avoid being a collateral damage. Accumulate enough information to detect when you are being used as a collateral damage but never bury your effort and time in trying to be an expert in things are in 80% of the time of no interest in your life goal and purpose.</p><p>One thing that is assured to everyone is DEATH.</p><p>So regardless of how selfish you choose to be, how oppressive you choose to be, how wealthy you ultimately become by oppressing people and plunging them into poverty, how influential you are, you will one day die.</p><p>You may be remembered from time to time, but ultimately you no longer exist on the face of the earth.</p><p>If you are reading this, know enough to not fall into a situation where you will be a collateral damage and die early. You have purpose in life to achieve and achieving it should be your life goal.</p><h3>Conclusion</h3><p>I don’t know the best way to summarise. It’s my birthday today, you just have to indulge me.</p><p>What I can say in conclusion is this.</p><p>The Gospel of Jesus Christ which has helped shape my mindset and has translated to the thought I have shared in this article has the most straightforward message and it is based on a book in the Holy Bible in Matthew 22:37–40, the summary of which is</p><blockquote>Love the Lord your God and Love all people regardless of who they are and where they come from. Do to them exactly how you would do for yourself.</blockquote><p>If everyone in the world lived this way, I doubt we will have these debates we have all year round.</p><p>Until I write you again, remember to run the good race and lead with love always.</p><p>See you next year.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=997ae3a63a8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why do you suffer?]]></title>
            <link>https://danielokoronkwo.medium.com/why-do-you-suffer-c1d16eeaa511?source=rss-b6a4a00ca2d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1d16eeaa511</guid>
            <category><![CDATA[bible]]></category>
            <category><![CDATA[inspiration]]></category>
            <category><![CDATA[encouragement]]></category>
            <dc:creator><![CDATA[Daniel Okoronkwo]]></dc:creator>
            <pubDate>Sun, 24 Aug 2025 15:08:08 GMT</pubDate>
            <atom:updated>2025-08-24T15:08:08.264Z</atom:updated>
            <content:encoded><![CDATA[<p>Here is your simple answer:</p><blockquote>“These things I have spoken to you, that in Me you may have peace. In the world you will have tribulation; but be of good cheer, I have overcome the world.”</blockquote><p>‭‭John‬ ‭16‬:‭33‬ ‭NKJV‬‬</p><p><a href="https://bible.com/bible/114/jhn.16.33.NKJV">John 16:33 These things I have spoken to you, that in Me you may have peace. In the world you will have tribulation; but be of good cheer, I have overcome the world.&quot; | New King James Version (NKJV) | Download The Bible App Now</a></p><p>For almost 2 months now in church our discussions(Bible study, Sunday Preaching etc) have centered around “Things that accompany salvation” as taken from Heb 6:9.</p><p>Let me tell you a few of the things that accompany Salvation:</p><ol><li>You will become a new creature — 2 Corinthians 5:17: Therefore if any man be in Christ, he is a new creature: old things are passed away; behold, all things are become new.</li></ol><p>2. You will have a new name — Abram became Abraham, according to Genesis 17:5. Jacob became Israel, Genesis 35:10. Saul became Paul in Acts 13:9</p><p>3. You will be known as “Sons of God” according to 1st John 3:1 and Roman 8:14–15:</p><p>For as many as are led by the Spirit of God, they are the sons of God.</p><p>For ye have not received the spirit of bondage again to fear; but ye have received the Spirit of adoption, whereby we cry, Abba, Father.</p><p>4. You will also be known as Joint heirs with Christ — Rom 8:16–17</p><p>The Spirit itself beareth witness with our spirit, that we are the children of God.</p><p>…and if children, then heirs; heirs of God, and joint-heirs with Christ; if so be that we suffer with him, that we may be also glorified together.</p><p>5. You will be known as a Friend of God — John 15:15</p><p>Henceforth I call you not servants; for the servant knoweth not what his lord doeth: but I have called you friends; for all things that I have heard of my Father I have made known unto you.</p><p>6. You will become God’s chosen/elect — John 15:16</p><p>Ye have not chosen me, but I have chosen you, and ordained you, that ye should go and bring forth fruit, and that your fruit should remain: that whatsoever ye shall ask of the Father in my name, he may give it you.</p><p>Colossians 3:12</p><p>Put on therefore, as the elect of God, holy and beloved, bowels of mercies, kindness, humbleness of mind, meekness, longsuffering;</p><p>1 Peter 2:9</p><p>But ye are a chosen generation, a royal priesthood, an holy nation, a peculiar people; that ye should shew forth the praises of him who hath called you out of darkness into his marvelous light</p><p>7. You be come Royalty in God’s sight — 1 Peter 2:9</p><p>8. You become a Salt of the earth — Matthew 5:13</p><p>Ye are the salt of the earth: but if the salt have lost his savor, wherewith shall it be salted? it is thenceforth good for nothing, but to be cast out, and to be trodden under foot of men.</p><p>9. You become the Light of the world — Matthew 5:14–16</p><p>Ye are the light of the world. A city that is set on an hill cannot be hid.</p><p>Neither do men light a candle, and put it under a bushel, but on a candlestick; and it giveth light unto all that are in the house.</p><p>Let your light so shine before men, that they may see your good works, and glorify your Father which is in heaven.</p><p>10. You gain Power — Act 1:38</p><p>But ye shall receive power, after that the Holy Ghost is come upon you: and ye shall be witnesses unto me both in Jerusalem, and in all Judæa, and in Samaria, and unto the uttermost part of the earth.</p><p>11. Prosperity — 3 John 1:2</p><p>Beloved, I wish above all things that thou mayest prosper and be in health, even as thy soul prospereth.</p><p>From this awesome list, you will realize that there are many beautiful things that you are entitled to as a result of your salvation.</p><p>None of the things in the list above make reference to any negative occurrence that we may encounter as a result of our salvation.</p><p>Does it mean that giving your life to Christ takes away every problem of the world ? If so why is everyone no rushing to be saved?</p><p>Today in church, we had a Q&amp;A session where people asked questions related to their salvation and what it means to be saved. There were a couple of people who asked questions around doubting their faith and they received the Holy Spirit inspired answer to their question but a particular question stood out in particular and it was asked by our head Pastor.</p><p>He said and I paraphrase</p><blockquote>Does being saved mean that you will no longer face trials and tribulations in this world?</blockquote><p>Another person added to the question by asking</p><blockquote>Must Christian who have truly given their life to Christ face difficulties?</blockquote><p>And that brings us to the scriptural reference at the beginning of this article. I hope you read it.</p><p>John Chapter 16 is popularly known as the fair well discourse. This was in the final hours before Jesus was arrested and crucified. The core message of that chapter was Jesus reminding the disciples of the trials and tribulations of the world that they will soon face. He told them that there will come a time when anyone who kills them will think they are doing God a Favour.</p><p>Jesus mentioned multiple times about the trials and tribulations that we will face in this world and but he also encouraged them to stand strong and be of good courage because He has overcome the world.</p><p>The truth is, you will face challenges. Being saved does not mean that you will not face problems. You will constantly battle the desires of the flesh. You will be ridiculed by your peers for being too “churchy”. You will hear people making mockery of the God who has saved you and maybe the worst part is that you will see them thriving and progressing in their chosen field while you make very little progress.</p><p>Those people could even be your boss at the place of work and they will constantly threaten your means of survival. What do you do in such case, do you give in just so you do not die…you could try that but all for what?</p><p>I have to be honest with you, it is easier said or written in this case than done. The world as we know it is cruel. To get access to the resources required to sustain life while you are here on earth requires you do many things and if we are being truthful a lot of them that would immediately skyrocket your relevance and financial capacity in this world requires you to be involved in shady activities that will definitely ruin your relationship with God.</p><p>I heard the story of a woman who considered suicide because of the difficulty she faced during pregnancy. From the way she told the story, a lot of her reasons for considering suicide were coming from a place of pain from feeling like God had abandoned her. She has always been faithful. She had a thriving business she was doing but because of pregnancy she could not continue and in that same period, her husband lost her Job. When the delivery date arrived, there was no money to go to the hospital and she already knew it was going to be a Caesarean Section. One of the days she was thinking deeply about a way out of this entire problem, she found herself walking aimlessly on the road, she got to a three-story building that was still under construction and she thought about and almost went to the topmost floor to end it all. Thank God that her husband was trailing her that night without her knowledge and was able to convince her not to take that route.</p><p>Given all these, Does it mean that God is no longer God?</p><p>Does it mean that God is no longer faithful?</p><p>Does it mean that your salvation has expired and you are reaping the fruits of previous sins?</p><p><strong>No</strong></p><p>God is still God and I know it maybe difficult to accept, this is all part of God’s plan. When you face this kind of situation, I encourage you to grieve and reminisce on it as much as you need to but remember Number 23:19 and Matthew 24:35</p><p>When upon life’s billows you are tempest tossed, when you are discouraged, thinking all is lost. I hope and pray that God will help you to remember to count your blessings and name them one by one. I am sure you will be surprised to see what God has done for you.</p><p>Till I write to you again, I am rooting. God bless you richly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1d16eeaa511" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Boredom is Good…Waiting even Better]]></title>
            <link>https://danielokoronkwo.medium.com/boredom-is-good-waiting-even-better-d9bd55ae7875?source=rss-b6a4a00ca2d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9bd55ae7875</guid>
            <category><![CDATA[youngadult]]></category>
            <category><![CDATA[career-advice]]></category>
            <category><![CDATA[work]]></category>
            <dc:creator><![CDATA[Daniel Okoronkwo]]></dc:creator>
            <pubDate>Sat, 16 Aug 2025 06:41:31 GMT</pubDate>
            <atom:updated>2025-08-16T06:41:31.073Z</atom:updated>
            <content:encoded><![CDATA[<p>I had one of my early morning random thoughts and I thought about putting it out here.</p><p>I would have loved to put this on my <a href="https://www.danielokoronkwo.com/">personal blog</a> but I am a bit skeptical because my goal from day one for my personal blog was to keep it professional and if I had to write anything outside of my profession as a software engineer, I will put it here on medium.</p><p>Now that you have read all that unimportant bit, let’s get started.</p><p>At an early age, parents who are very intentional about their child’s growth trajectory would make it their daily grind to stare their child into the direction that will eventually lead them to the path they would “love” for their child and for children who fall into this category most times it is very easy for them to know what they want to do and the steps they may take to accomplish them.</p><p>You might read this and think, my parents didn’t exactly do anything exceptional to contribute to where I am and when we look at it you may have a few points to back up your claim and given that my what I just wrote may be controversial, I would like to lay down what I mean by intentionality on the parent’s path and how it differs from the people I would talk about later.</p><ul><li>If you are a Lawyer today, there is a huge chance that your parents or a family relative whose career trajectory inspires you is also a Lawyer.</li><li>If you are a <strong>Doctor</strong> today, your parents are either doctors or they have taken you to a place where you were very much inspired by Doctors</li></ul><p>What I am trying to say here is, maybe your parents are not directly involved, by previously being in the profession you are currently in but they may have put you in a position to be inspired to be in that profession and that alone is a privilege you may not realize that you have been given.</p><p>There are ton of people out who grew up without having such opportunities and they had to leave the house when they became a lot older and that is usually during the university days where they realize that they only attend classes because they were told that it is their role as a student.</p><p>They do not understand how the course they are studying can be applied in real life or whether they are passionate about it in the first place and that brings me to the point of this article.</p><p><em>I have seen a lot of people in their early to late twenties running from pillar to post looking for what they can do especially when they are already done with their university degree. When most people see this they begin to wonder what exactly has this person been doing in all the years they spent in the university walls and what exactly is the use of the degree.</em></p><p>Well I want to tell you something that I have discovered and when you read this you will realize that you were probably here at some point in your life and you made it out or that you are currently here. Either way stick around so that you can get the full gist.</p><p>Most people are looking for the kind of work to engage in where there would be minimal effort but huge reward. There are also people who try out many things and for each one they try, when there is a slight difficulty, mental strain or a bit of boredom, they move on to the next shiny thing that people on the internet says that it can earn them all the money in the world.</p><p>This is why you notice those people who I mentioned earlier, when you probe further into how they have spent the past few years of their life, you hear things like</p><p><strong><em>“I use to be crypto trader and I did digital marketing at some point ooo, but It just didn’t work for me, the things they were saying there were just very boring I could not keep up and that’s why I am now a CV writer”</em></strong></p><p>When you notice this patterns it all boils down to the moral lesson of this article. When we are growing up especially with parents who are <strong>not</strong> very conversant with the current state of the world or parents who do not understand exactly how to create the best path for their child to “become a doctor”, it is your responsibility as a young person to first find <strong><em>something to do</em></strong> rather than something you are <strong><em>passionate</em></strong> about.</p><p>The work to do may be boring or have very low reward, that’s fine. Such work will create the <strong><em>much needed hatred </em></strong>that will force you to find the exact thing that tickles your fancy or the one you are passionate about. It also helps you grow a resilient mindset which will be required when you get the work that you are passionate about…because there is huge chance that what you are passionate about will will at some point get very tiring or close to boring…</p><p>If you decide to run from one work to the other, without developing that mindset, there is a huge chance that you have already found what you like to do or what you are passionate about but you have left it for the next shiny and cool work and that is the problem.</p><p>You will keep running around in circles and will never pitch your tent anywhere. You will eventually become a jack of all trade and a master of none but often time better than a master of one — nah you will only be better than a master of one, if that person has not grinded hard enough to move above sea level in that career path or work so don’t let the end part of the idiom fool you</p><h3><strong>Conclusion</strong></h3><p>If you are in your late twenties and do not know where you life is headed or what you want to do, just find something to do first and when you do, no matter how boring or low rewarding it might be, I implore you to do it long enough to build some resilience and figure out what next you want to do in your life. Maybe you will develop genuine hatred that will spur you to take the next big step and not chase the next shiny work out there.</p><p>Until I write you again, I am rooting for you. Keep grinding, keep pushing, it will all align one day, it always aligns at some point.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9bd55ae7875" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detect LinkedList Cycle Leetcode Solution with Explanation and Illustrations]]></title>
            <link>https://danielokoronkwo.medium.com/detect-linkedlist-cycle-leetcode-solution-with-explanation-and-illustrations-72fb2505f19e?source=rss-b6a4a00ca2d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/72fb2505f19e</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[datastrucutre]]></category>
            <category><![CDATA[linked-list-cycle]]></category>
            <dc:creator><![CDATA[Daniel Okoronkwo]]></dc:creator>
            <pubDate>Tue, 27 Sep 2022 14:09:06 GMT</pubDate>
            <atom:updated>2023-10-19T10:11:41.544Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are curious and you would like to take a look at the question yourself, you can find it <a href="https://leetcode.com/problems/linked-list-cycle-ii">here</a></p><p>In this very brief article, we would go over my approach to solving this question using beautiful illustrations that will effectively capture the idea behind the solution so stick with me to the end.</p><p>Before we dive directly into the solution to the question, let’s talk about the very famous two-pointer technique used in solving some questions that involve linear data structures like Arrays and LinkedList.</p><p><strong>The Two Pointer Technique(TPT)</strong></p><p>If you perform a quick google search, you would get a lot of explanations about the two pointer technique, this is partly due to its ability to help programmers keep a reference to 2 elements in a linear data structure while iterating once thus giving the opportunity to avoid <strong>O(n²)</strong> operations in certain scenarios, but also it is a popular choice for solving LinkedList related problems that require iterating a LinkedList.</p><p>We would be talking about <strong>TPT</strong> in the context of LinkedList</p><p>The two-pointer technique sometimes also called the hare and tortoise technique entails having two pointers(fast and slow) <strong>variables</strong> actually, that start at the same position in a LinkedList but while working through the list the fast pointer moves twice as fast as the slow pointer as Illustrated below.</p><figure><img alt="The fast pointer of the linkedlist moves twice as fast as the slow pointer" src="https://cdn-images-1.medium.com/max/1024/1*o_y-YQP5pw3Aw2NeZtpx_Q.png" /></figure><p>This is usually very useful in LinkedList in that it allows us to <strong>detect a cycle</strong> in a LinkedList which is exactly what the question we want to solve later is about</p><p><strong>What is a cycle in a LinkedList?</strong></p><p>A cycle occurs in a LinkedList when the tail node points to another node somewhere in the list or at the beginning of the list as illustrated below.</p><figure><img alt="LinkedList Cycle Representation" src="https://cdn-images-1.medium.com/max/1024/1*gGeKOufQvURVMiQ0VkXJ-g.png" /></figure><p>Using the two-pointer technique, when a LinkedList is a cycle, although the two-pointers(fast and slow) move at different speeds they would eventually meet at some point while walking through the list no matter the length of the list as Illustrated below.</p><figure><img alt="Verifying that the two pointers will eventually meet" src="https://cdn-images-1.medium.com/max/1024/1*M0wW_HcxSnmOhEW0k5hiPg.png" /></figure><p><strong>Have we reached the solution already?</strong></p><p>Hell yeah, we are here. Let’s take a look at the question and come up with potential solutions.</p><p><strong><em>Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null.</em></strong></p><p><strong><em>There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is used to denote the index of the node that the tail’s next pointer is connected to (0-indexed). It is -1 if there is no cycle. Note that “pos” is not passed as a parameter.</em></strong></p><p><strong><em>Do not modify the linked list.</em></strong></p><p>If we understand the question perfectly, we are given the head of a Singly-LinkedList and we are asked to walk through the list and get the node that makes this list a cycle. The point in which the List becomes a cycle is that point where the tail node connects to a node within the list as illustrated below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4tNkcEON_55fXfKicQex_w.png" /></figure><p>Internally Leetcode uses <strong>“pos”</strong> to reference the node where the tails node points in order to create a cycle. Up until now, I do not know how to create this manually so that I can run my own custom test using my custom implementation of a Singly-LinkedList that you can find <a href="https://github.com/Varsilias/data-structures-and-algorithms/blob/master/DataStructures/LinkedLists/SinglyLinkedList.js">here</a>.</p><p>Initially, I thought this is easy, because from the Illustration below if there is a cycle in a LinkedList, given the head, if we have two pointers, one that moves twice as fast as the other we already know that they would eventually meet but what is even more interesting is that in <strong>most cases</strong> they would meet at the node whose <strong>next</strong> is the node that <strong>started the cycle(which is usually the tail node)</strong>.</p><p>What this means is that if we called the <strong>“meet point’s”</strong> next value we would get our guy and that would be our solution.</p><figure><img alt="The meet point’s next value is the beginning of the cycle" src="https://cdn-images-1.medium.com/max/1024/1*wTrJ91-G-KnuzEE-cepzWw.png" /></figure><p>But what about this specific case?</p><figure><img alt="The initial solution does not hold through for this special case" src="https://cdn-images-1.medium.com/max/1024/1*ehIB-tsB6V46EPz8vrLHmw.png" /></figure><p>Using the first solution, this special case would not work, at least not for all cases as we have seen but this solution would help us in coming up with an actual solution.</p><p><strong>The solution</strong></p><p>The solution to this problem requires 3</p><ol><li>First, verify that the LinkedList is a cycle by looping using the two-pointer technique from the head of the list till the two-pointers meet, if they never meet we return *<strong>NULL</strong>* since the list is not a cycle in the first place</li><li>If it is true that it is a cycle the slow pointer would be at the back of the node that starts the cycle, we would then declare a new variable pointing to the head again and loop through using a while loop.</li><li>provided that our new variable is not the same as the slow pointer(which should currently be at the back of the node that begins the cycle) we keep moving until the while loop condition becomes true, at this point we can return the new variable or slow</li></ol><p>Let’s look at a visual representation of the solution before we proceed to write the actual code implementation</p><figure><img alt="Visual representation of the solution" src="https://cdn-images-1.medium.com/max/1024/1*1rcvBVONz7CXVugmRFGenA.png" /></figure><p>Here is a JavaScript version of the solution</p><figure><img alt="Full Solution to LinkedList Cycle II Question on Leetcode" src="https://cdn-images-1.medium.com/max/1024/1*HyfI95kE87798aWeAEjGKA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72fb2505f19e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Complete Guide to Implementing Apple OAuth 2.0(Sign]]></title>
            <link>https://danielokoronkwo.medium.com/complete-guide-to-implementing-apple-oauth-2-0-sign-b392d3e995c2?source=rss-b6a4a00ca2d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/b392d3e995c2</guid>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[sign-in-with-apple]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[Daniel Okoronkwo]]></dc:creator>
            <pubDate>Sun, 01 May 2022 02:56:34 GMT</pubDate>
            <atom:updated>2022-05-01T04:19:41.475Z</atom:updated>
            <content:encoded><![CDATA[<h3>Complete Guide to Implementing Apple OAuth 2.0(Sign in with Apple) Authentication In a Node/Express Application</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*cIr6fkDQrcYMGAlyPq6B7g.png" /><figcaption>Sign in with Apple in various sizes: 130x30, 200x30, 260x30, 130x50, 130x100, 200x100, 260x100, 300x100</figcaption></figure><p><strong>What is OAuth?</strong></p><p>OAuth, short for Open Authorization, is a standard that allows users to give third-party clients usually web applications, mobile applications, desktop applications, etc access to their basic data located on another server without giving up their sensitive data like passwords or any other encrypted data.</p><p>OAuth allows data to be exchanged between different servers at different locations provided that the user in question authorizes the data exchange. This protocol gives a faster on-boarding experience for users on other applications by transferring their already existing details from an identity provider to a third-party application that needs access to this information.</p><p><a href="https://en.wikipedia.org/wiki/OAuth">Here is a link to read more about OAuth.</a></p><p><strong>How OAuth 2.0 Works:</strong></p><p>Here is an example summary of how the OAuth 2.0 works</p><ol><li>The third-party application e.g web, mobile or desktop application sends a request to the Identity Provider e.g Google, Apple, Facebook, Twitter, GitHub specifying the redirect URL. The redirect URL is a web-hook URL that the identity provider uses to securely transmit sensitive data to the third-party application after the user has authorized the identity provider.</li></ol><p>2. The Identity provider prompts the user to authorize the data transfer.</p><p>3. The identity provider issues an Authorization code to the third-party application.</p><p>4. The third-party application exchanges the Authorization code with the identity provider for an Identity token, a refresh token and access token.</p><p>5. The Identity token is a JWT string that can be decoded to access the user’s information.</p><p>6. The third-party application can choose to decode and retrieve the user information(This is less secure as the signature of the JWT token may have been tampered with during the transmission) or utilize the access token to make further requests to the identity provider to retrieve the user’s information.</p><p>7. The third-party application uses the access token to request the user’s data on behalf of the user.</p><p>While this procedure is pretty straightforward and vastly used by several identity providers, Apple’s OAuth2 implementation seems to be a lot different and quite challenging for a lot of developers to implement. I guess this is mostly because of Apple’s user privacy policy.</p><p>Before we proceed, let’s point out some of the differences that exist between Apple’s OAuth implementation and the widely used implementation by some of the other identity providers.</p><ul><li>Apple gives its users the option to hide their email addresses while registering for certain services on third-party websites. If users choose to hide their email during the authorization process, Upon completion of the entire Authorization process, Apple issues a proxy email to the third-party website that redirects all the emails sent to the proxy email to the user’s real email address. Apple says that they do this to prevent spamming of their users.</li><li>Unlike most identity providers, at the time of writing there is no REST API endpoint to access the user’s profile information using a server-issued access token on behalf of the user, this makes it difficult to rely on the “Sign in with Apple” option as the only source of truth when on-boarding new users in a third-party application.</li></ul><p><a href="https://developer.apple.com/documentation/sign_in_with_apple/">Here is a link to Apple’s documentation on “Sign in with Apple”</a></p><p><strong>Let’s get Started</strong></p><p>Before we proceed, let’s consider how we want our application to work.</p><p>The client-side of the application(Web or Mobile) which for the sake of this tutorial we would not talk about in-depth, would initiate the entire authorization flow, get the access, refresh and identity token and then send a POST request to an API endpoint that we would define in our Node/Express back-end server with either of the access token or the identity token.</p><p>For some identity providers like Google or Facebook, it would be best that the client sends the access token as this would allow our server to retrieve the user’s details on their behalf using an endpoint provided by Google and Facebook or any other identity provider.</p><p>In Apple’s case, though not explicitly specified in the developer documentation, as at the point of writing this article there is no endpoint provided by Apple to retrieve the user’s data on their behalf using the access token provided by Apple. With that said, as recommended by Apple on the <a href="https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api/verifying_a_user">developer documentation</a>, we would be depending on the identity token(id_token) which I earlier stated is a JSON Web Token string containing some of the user information like email, sub etc. We would not just decode the token and retrieve the user information, that would not be nice since anyone with the technical knowledge can create a JWT string and also decode it.</p><p>In order to verify an Identity token issued by Apple, there are steps Apple recommends and they are all outlined in this part of the Apple developer <a href="https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api/verifying_a_user">documentation</a>. One particular point I would like to highlight in this article which is also the approach we would be using in this article is to <strong>verify the JWS E256 signature using the server’s public key.</strong> Of course, this would sound confusing at first and at this point you may already be tempted to just decode the identity token and retrieve the data you need but that wouldn’t be a good approach and would also lead to a technical debt that could cause the company you work for huge amounts of money in the future.</p><p>The API endpoint that we would define in our Node/Express back-end server would need the identity token to be passed in the request body when the request is to be sent and yes your guess is as good as mine, the request would be a <strong>POST</strong> request. The endpoint would also be responsible for making validating and verifying <strong>the JWS E256 signature </strong>of the identity token<strong> using the server’s public key</strong> in some kind of cryptographic manner and at the same time retrieving the user information from the token.</p><p>Enough of the boring talk, let’s write some code.</p><p>In order to follow along, you will need <a href="https://nodejs.org/">nodejs </a>installed. Nodejs version &gt;= 10.x would do. The example code for this tutorial would be based on Nodejs version 16.x.</p><p>Nodejs by default comes with NPM a package manager that allows developers to pull libraries and packages into their development workflow from <a href="https://www.npmjs.com/">the registry</a>.</p><p>For this article, I would be using the <a href="https://yarnpkg.com/">yarn package manager</a>.</p><p>Let’s set up a mini Nodejs/Express server with one endpoint that would allow our client-side applications to send a POST request with the id_token.</p><p>Create a folder and name it whatever you want to. Inside the folder for a start, we will install <a href="https://github.com/expressjs/express">express</a> and <a href="https://github.com/remy/nodemon">nodemon</a> By running the command</p><pre><strong>npm install -–save express nodemon</strong></pre><p><strong>Or</strong></p><pre><strong>yarn add express nodemon</strong></pre><p><strong>if you are using yarn just like me</strong>.</p><p>Create an index.js file at the root of the project folder and add the below snippet</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C184%252C195%252C100%2529%26t%3Dnight-owl%26wt%3Dnone%26l%3Djavascript%26width%3D680%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D48px%26ph%3D32px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D13px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%252520express%252520%25253D%252520require%2528%252522express%252522%2529%25250D%25250A%252520%25250D%25250Aconst%252520app%252520%25253D%252520express%2528%2529%25253B%25250D%25250Aconst%252520PORT%252520%25253D%2525203000%25253B%25250D%25250A%252520%25250D%25250Aapp.post%2528%252522%25252Fauth%25252Fapple%252522%25252C%252520%2528req%25252C%252520res%2529%252520%25253D%25253E%252520%25257B%25250D%25250A%252520%252520const%252520%25257B%252520id_token%252520%25257D%252520%25253D%252520req.body%25250D%25250A%25257D%2529%25250D%25250A%252520%25250D%25250Aapp.listen%2528PORT%25252C%252520%2528%2529%252520%25253D%25253E%252520console.log%2528%252560Server%252520listening%252520on%252520port%252520%252524%25257BPORT%25257D%252560%2529%2529&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C184%25252C195%25252C100%252529%26t%3Dnight-owl%26wt%3Dnone%26l%3Djavascript%26width%3D680%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D48px%26ph%3D32px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D13px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%25252520express%25252520%2525253D%25252520require%252528%25252522express%25252522%252529%2525250D%2525250A%25252520%2525250D%2525250Aconst%25252520app%25252520%2525253D%25252520express%252528%252529%2525253B%2525250D%2525250Aconst%25252520PORT%25252520%2525253D%252525203000%2525253B%2525250D%2525250A%25252520%2525250D%2525250Aapp.post%252528%25252522%2525252Fauth%2525252Fapple%25252522%2525252C%25252520%252528req%2525252C%25252520res%252529%25252520%2525253D%2525253E%25252520%2525257B%2525250D%2525250A%25252520%25252520const%25252520%2525257B%25252520id_token%25252520%2525257D%25252520%2525253D%25252520req.body%2525250D%2525250A%2525257D%252529%2525250D%2525250A%25252520%2525250D%2525250Aapp.listen%252528PORT%2525252C%25252520%252528%252529%25252520%2525253D%2525253E%25252520console.log%252528%25252560Server%25252520listening%25252520on%25252520port%25252520%25252524%2525257BPORT%2525257D%25252560%252529%252529&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8dd87a934f63068f8ff6b405817df9ff/href">https://medium.com/media/8dd87a934f63068f8ff6b405817df9ff/href</a></iframe><p>In the above snippet</p><ul><li>We imported the express package we installed earlier</li><li>Created an instance of express</li><li>Created a route <strong>/auth/apple</strong></li><li>We serve the app and listen on PORT 3000 for incoming request</li><li>We are also destructing the property <strong>id_token</strong> from the incoming request body just like earlier stated</li></ul><p>Next, we need to verify <strong>the JWS E256 signature of the id_token using the server’s public key </strong>just as apple recommends.</p><p>First, what is the server public key and how do we fetch it?</p><p>The server public key is referred to by Apple as a JWK key set located in this part of the developer <a href="https://developer.apple.com/documentation/sign_in_with_apple/fetch_apple_s_public_key_for_verifying_token_signature">documentation</a>.</p><p>According to the documentation, when we send a <strong>GET </strong>request to</p><p><a href="https://appleid.apple.com/auth/keys"><strong>https://appleid.apple.com/auth/keys</strong></a><strong> </strong>we get a JSON keys response in the format below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TMwHqBaQUQgABWaVz6hozw.png" /><figcaption><a href="https://appleid.apple.com/auth/keys"><strong>https://appleid.apple.com/auth/keys</strong></a><strong> </strong>response snippet</figcaption></figure><p>The response above is a <a href="https://auth0.com/docs/secure/tokens/json-web-tokens/json-web-key-sets">JWKS key set</a>. The JWKS key set contains information needed to get the Apple public key that would be used to verify the JWS E256 signature of the id_token. It is quite difficult to write specific detail on how to get the public key from this JWKS but in this article, we would use <a href="https://www.npmjs.com/package/jwks-rsa">jwk-rsa</a>, a nodejs package that converts a set of JWK keys into an equivalent Public key.</p><p>Install the package by running the command</p><pre><strong>npm install --save jwks-rsa</strong></pre><p>Or</p><pre><strong>yarn add jwks-rsa</strong></pre><p>To generate the public key with this package we would require a <strong>“kid” </strong>that matches one of the<strong> kid properties</strong> on the JWKS key set returned from the Apple server. From the attached image below, we can see that For every Apple issued Id_token, there exists a <strong>“kid”</strong> property on the header of the decoded id_token</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*PG7plBH7Z1hH-Rnj2tuHqQ.png" /><figcaption>Apple Issued id_token when decoded</figcaption></figure><p>In order to get the “kid” from the header of id_token, we would need to decode the token and get the header and then get the “kid” from the header. For this, we can use the<strong> jsonwebtoken</strong> nodejs package to decode the id_token.</p><pre><strong>npm install --save jsonwebtoken</strong></pre><p>Or</p><pre><strong>yarn add jsonwebtoken</strong></pre><p>Modify the initial code by adding the following line</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dseti%26wt%3Dnone%26l%3Dapplication%252Ftypescript%26width%3D680%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%252520express%252520%25253D%252520require%2528%252522express%252522%2529%25250Aconst%252520jwt%252520%25253D%252520require%2528%252522jsonwebtoken%252522%2529%25253B%25250A%252520%25250A%252520%25250Aconst%252520app%252520%25253D%252520express%2528%2529%25253B%25250Aconst%252520PORT%252520%25253D%2525203000%25253B%25250A%252520%25250A%252520%25250A%252520%25250Aapp.post%2528%252522%25252Fauth%25252Fapple%252522%25252C%252520%2528req%25252C%252520res%2529%252520%25253D%25253E%252520%25257B%25250A%252520%252520const%252520%25257B%252520id_token%252520%25257D%252520%25253D%252520req.body%25250A%252520%252520const%252520%25257B%252520header%252520%25257D%252520%25253D%252520jwt.decode%2528id_token%25252C%252520%25257B%25250A%252520%252520%252520%252520complete%25253A%252520true%25250A%252520%252520%25257D%2529%25250A%252520%25250A%252520%252520const%252520kid%252520%25253D%252520header.kid%25250A%25257D%2529%25250A%252520%25250Aapp.listen%2528PORT%25252C%252520%2528%2529%252520%25253D%25253E%252520console.log%2528%252560Server%252520listening%252520on%252520port%252520%252524%25257BPORT%25257D%252560%2529%2529%25250A%252520%25250A&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dseti%26wt%3Dnone%26l%3Dapplication%25252Ftypescript%26width%3D680%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%25252520express%25252520%2525253D%25252520require%252528%25252522express%25252522%252529%2525250Aconst%25252520jwt%25252520%2525253D%25252520require%252528%25252522jsonwebtoken%25252522%252529%2525253B%2525250A%25252520%2525250A%25252520%2525250Aconst%25252520app%25252520%2525253D%25252520express%252528%252529%2525253B%2525250Aconst%25252520PORT%25252520%2525253D%252525203000%2525253B%2525250A%25252520%2525250A%25252520%2525250A%25252520%2525250Aapp.post%252528%25252522%2525252Fauth%2525252Fapple%25252522%2525252C%25252520%252528req%2525252C%25252520res%252529%25252520%2525253D%2525253E%25252520%2525257B%2525250A%25252520%25252520const%25252520%2525257B%25252520id_token%25252520%2525257D%25252520%2525253D%25252520req.body%2525250A%25252520%25252520const%25252520%2525257B%25252520header%25252520%2525257D%25252520%2525253D%25252520jwt.decode%252528id_token%2525252C%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520complete%2525253A%25252520true%2525250A%25252520%25252520%2525257D%252529%2525250A%25252520%2525250A%25252520%25252520const%25252520kid%25252520%2525253D%25252520header.kid%2525250A%2525257D%252529%2525250A%25252520%2525250Aapp.listen%252528PORT%2525252C%25252520%252528%252529%25252520%2525253D%2525253E%25252520console.log%252528%25252560Server%25252520listening%25252520on%25252520port%25252520%25252524%2525257BPORT%2525257D%25252560%252529%252529%2525250A%25252520%2525250A&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/7625bf0071f66c6d532f846853252736/href">https://medium.com/media/7625bf0071f66c6d532f846853252736/href</a></iframe><p>The time we have all been waiting for.</p><p>In order to generate the public key modify the code to look like the one below</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dseti%26wt%3Dnone%26l%3Dapplication%252Ftypescript%26width%3D680%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%252520express%252520%25253D%252520require%2528%252522express%252522%2529%25250Aconst%252520jwksClient%252520%25253D%252520require%2528%252522jwks-rsa%252522%2529%25253B%25250Aconst%252520jwt%252520%25253D%252520require%2528%252522jsonwebtoken%252522%2529%25253B%25250A%252520%25250A%252520%25250Aconst%252520app%252520%25253D%252520express%2528%2529%25253B%25250Aconst%252520PORT%252520%25253D%2525203000%25253B%25250A%252520%25250A%252520%25250Aasync%252520function%252520key%2528kid%2529%252520%25257B%25250A%252520%252520const%252520client%252520%25253D%252520jwksClient%2528%25257B%25250A%252520%252520%252520%252520jwksUri%25253A%252520%252522https%25253A%25252F%25252Fappleid.apple.com%25252Fauth%25252Fkeys%252522%25252C%25250A%252520%252520%252520%252520timeout%25253A%25252030000%25250A%252520%252520%25257D%2529%25253B%25250A%252520%25250A%252520%252520return%252520await%252520client.getSigningKey%2528kid%2529%25253B%25250A%25257D%25250A%252520%25250Aapp.post%2528%252522%25252Fauth%25252Fapple%252522%25252C%252520async%252520%2528req%25252C%252520res%2529%252520%25253D%25253E%252520%25257B%25250A%252520%252520const%252520%25257B%252520id_token%252520%25257D%252520%25253D%252520req.body%25250A%252520%252520const%252520%25257B%252520header%252520%25257D%252520%25253D%252520jwt.decode%2528id_token%25252C%252520%25257B%25250A%252520%252520%252520%252520complete%25253A%252520true%25250A%252520%252520%25257D%2529%25250A%252520%25250A%252520%252520const%252520kid%252520%25253D%252520header.kid%25250A%252520%252520const%252520publicKey%252520%25253D%252520%2528await%252520key%2528kid%2529%2529.getPublicKey%2528%2529%25250A%252520%252520console.log%2528publicKey%2529%25250A%25257D%2529%25250A%252520%25250Aapp.listen%2528PORT%25252C%252520%2528%2529%252520%25253D%25253E%252520console.log%2528%252560Server%252520listening%252520on%252520port%252520%252524%25257BPORT%25257D%252560%2529%2529%25250A&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dseti%26wt%3Dnone%26l%3Dapplication%25252Ftypescript%26width%3D680%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%25252520express%25252520%2525253D%25252520require%252528%25252522express%25252522%252529%2525250Aconst%25252520jwksClient%25252520%2525253D%25252520require%252528%25252522jwks-rsa%25252522%252529%2525253B%2525250Aconst%25252520jwt%25252520%2525253D%25252520require%252528%25252522jsonwebtoken%25252522%252529%2525253B%2525250A%25252520%2525250A%25252520%2525250Aconst%25252520app%25252520%2525253D%25252520express%252528%252529%2525253B%2525250Aconst%25252520PORT%25252520%2525253D%252525203000%2525253B%2525250A%25252520%2525250A%25252520%2525250Aasync%25252520function%25252520key%252528kid%252529%25252520%2525257B%2525250A%25252520%25252520const%25252520client%25252520%2525253D%25252520jwksClient%252528%2525257B%2525250A%25252520%25252520%25252520%25252520jwksUri%2525253A%25252520%25252522https%2525253A%2525252F%2525252Fappleid.apple.com%2525252Fauth%2525252Fkeys%25252522%2525252C%2525250A%25252520%25252520%25252520%25252520timeout%2525253A%2525252030000%2525250A%25252520%25252520%2525257D%252529%2525253B%2525250A%25252520%2525250A%25252520%25252520return%25252520await%25252520client.getSigningKey%252528kid%252529%2525253B%2525250A%2525257D%2525250A%25252520%2525250Aapp.post%252528%25252522%2525252Fauth%2525252Fapple%25252522%2525252C%25252520async%25252520%252528req%2525252C%25252520res%252529%25252520%2525253D%2525253E%25252520%2525257B%2525250A%25252520%25252520const%25252520%2525257B%25252520id_token%25252520%2525257D%25252520%2525253D%25252520req.body%2525250A%25252520%25252520const%25252520%2525257B%25252520header%25252520%2525257D%25252520%2525253D%25252520jwt.decode%252528id_token%2525252C%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520complete%2525253A%25252520true%2525250A%25252520%25252520%2525257D%252529%2525250A%25252520%2525250A%25252520%25252520const%25252520kid%25252520%2525253D%25252520header.kid%2525250A%25252520%25252520const%25252520publicKey%25252520%2525253D%25252520%252528await%25252520key%252528kid%252529%252529.getPublicKey%252528%252529%2525250A%25252520%25252520console.log%252528publicKey%252529%2525250A%2525257D%252529%2525250A%25252520%2525250Aapp.listen%252528PORT%2525252C%25252520%252528%252529%25252520%2525253D%2525253E%25252520console.log%252528%25252560Server%25252520listening%25252520on%25252520port%25252520%25252524%2525257BPORT%2525257D%25252560%252529%252529%2525250A&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/94f820dafb8148e880a94f446c678686/href">https://medium.com/media/94f820dafb8148e880a94f446c678686/href</a></iframe><p>When you send a POST request to <strong>http://localhost:3000/auth/apple</strong> and pass the Apple issued <strong>id_token</strong>, you will get a string in the following format in the console</p><pre>-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvqNYBKQeFfPlSDq3kGxg<br>GtcMiCta7Tl/eirZ8T7knlEQomJjQN1z4p1rfhnA6m2dSh5/cnAo8MByRMlAO6DB<br>401k/A6YUxEqPjGoSnESQhfwL7MezjVDrHnhlnLTFT5a9MZx2PPJlNn+HSI5iKyz<br>AVBP+zrvnS1kbQE4G1nmpL/zS2ZYfvEWK2B7B1a14loBIT947Woy102yn1/E603l<br>T+lkNTIWbdhF85w4PNWqnfA7P51wpvtx1k3XURgZk6SMR6Slx53McKj0fho6Z0oK<br>nK2ov/0VeiKFwEyDf2zU5bdx/B+B/n+S84l1ypHg+gBNBN+wNWh4xZUHhcsZHpIL<br>mQIDAQAB<br>-----END PUBLIC KEY-----</pre><p>With the string above, we can then <strong>verify the JWS E256 signature</strong> <strong>of the Apple issued id_token</strong> by modifying the code a little.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*EFgJEAyv6YMKNVvG-C0FVg.png" /></figure><p>If everything works without errors, an Object of type JWTPayload containing the sub and email as well as other properties.</p><p>You can go ahead to store the email and sub in the database depending on your application needs.</p><p><strong>Conclusion</strong></p><p>In this article our major focus has been on ensuring that we are able to verify the JWS signature of an Apple issued id_token.</p><p>While this is properly covered here, you may need to take certain steps before needing this article in the first place. For instance, how to get the necessary Apple credentials like <strong>Client Secret</strong>, <strong>Client ID. </strong>You will most likely spend a substantial amount of time in the Apple developer documentation before achieving your aim.</p><p><a href="https://sarunw.com/posts/sign-in-with-apple-1/">Here is a link to how you can get the above mentioned credentials</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b392d3e995c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>