Giter Club home page Giter Club logo

learnoauth's Introduction

a01-blog

https://sharmarajdaksh.github.io/blog/github-oauth-with-go

https://www.sohamkamani.com/golang/oauth/

a02-wtf

https://github.com/settings/applications/1818912

The goal here is to get auth1 functionality with mux and google oauth2, similar to warg.

Then I can add the session stuff as well as state param

a03-securecookie

https://developpaper.com/go-one-library-per-day-gorilla-securecookie/

Let's just copy this :)

$ curl -i http://localhost:8080/set
HTTP/1.1 200 OK
Set-Cookie: user=MTY0Mzg0MTU3OHx6d3V4anI1QU9vdXlUQTBPVWhEd2U3VUw0RGZsWmlkNG9QaEM5LWEtWEVoa0NzYWJ5c0o4ZFhHVklvMUFGNXVqQkdQV0IyQlhHV05DT0xaY2dpZz18PI_0-opCO2ynG5JNeG-2qa38cLwJTkByv1EC5lSROdE=; Path=/; HttpOnly; Secure
Date: Wed, 02 Feb 2022 22:39:38 GMT
Content-Length: 12
Content-Type: text/plain; charset=utf-8

Hello World
14:39:38.131 PST mac02:~
$ curl -i http://localhost:8080/get --cookie 'user=MTY0Mzg0MTU3OHx6d3V4anI1QU9vdXlUQTBPVWhEd2U3VUw0RGZsWmlkNG9QaEM5LWEtWEVoa0NzYWJ5c0o4ZFhHVklvMUFGNXVqQkdQV0IyQlhHV05DT0xaY2dpZz18PI_0-opCO2ynG5JNeG-2qa38cLwJTkByv1EC5lSROdE=; Path=/; HttpOnly; Secure'
HTTP/1.1 200 OK
Date: Wed, 02 Feb 2022 22:40:04 GMT
Content-Length: 14
Content-Type: text/plain; charset=utf-8

name:dj age:18%

a04-cookie

  • set cookie on login
  • save the following into a data structure
    • user auth information from /login/github/callback (token)
    • username
    • cookie
  • redirect the user a page showing GitHub info if they're logged in

https://pkg.go.dev/github.com/benbjohnson/wtf#Auth

Ok, it looks like I'm setting the cookie in the response, but the browser isn't sending the cookie back. This leads to an Oauth state mismatch

Let's make a "set and read cookie" folder until I can get back to this...

learnoauth's People

Contributors

bbkane avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.