+4
-4
README.md
+4
-4
README.md
···
1
# Atproto OAuth Golang
2
3
-
> [!WARNING]
4
> This is an experimental repo. It may contain bugs. Use at your own risk.
5
6
> [!WARNING]
7
> You should always validate user input. The example/test code inside this repo may be used as an implementation guide, but no guarantees are made.
8
9
```bash
10
-
go get github.com/haileyok/atproto-oauth-golang
11
```
12
13
## Prerequisites
···
18
19
`make jwks`
20
21
-
You will need to read the JWK from your application and parse it using `oauth.ParseJWKFromBytes`.
22
23
### Serve `client-metadata.json` from your application
24
···
144
145
#### Create a private DPoP JWK for the user
146
147
-
You'll need to create a private DPoP JWK for the user before directing them to their PDS to authenticate. You'll need to store this in a later step, and you will need to pass it along inside the PAR request, so go ahead and marshal it as well.
148
149
```go
150
k, err := helpers.GenerateKey(nil)
···
1
# Atproto OAuth Golang
2
3
+
> [!WARNING]
4
> This is an experimental repo. It may contain bugs. Use at your own risk.
5
6
> [!WARNING]
7
> You should always validate user input. The example/test code inside this repo may be used as an implementation guide, but no guarantees are made.
8
9
```bash
10
+
go get tangled.sh/icyphox.sh/atproto-oauth
11
```
12
13
## Prerequisites
···
18
19
`make jwks`
20
21
+
You will need to read the JWK from your application and parse it using `oauth.ParseJWKFromBytes`.
22
23
### Serve `client-metadata.json` from your application
24
···
144
145
#### Create a private DPoP JWK for the user
146
147
+
You'll need to create a private DPoP JWK for the user before directing them to their PDS to authenticate. You'll need to store this in a later step, and you will need to pass it along inside the PAR request, so go ahead and marshal it as well.
148
149
```go
150
k, err := helpers.GenerateKey(nil)
+1
-1
cmd/helper/main.go
+1
-1
cmd/helper/main.go
+1
-1
cmd/web_server_demo/handle_auth.go
+1
-1
cmd/web_server_demo/handle_auth.go
···
9
10
"github.com/bluesky-social/indigo/atproto/syntax"
11
"github.com/gorilla/sessions"
12
-
oauth_helpers "github.com/haileyok/atproto-oauth-golang/helpers"
13
"github.com/labstack/echo-contrib/session"
14
"github.com/labstack/echo/v4"
15
"gorm.io/gorm/clause"
16
)
17
18
func (s *TestServer) handleLoginSubmit(e echo.Context) error {
···
9
10
"github.com/bluesky-social/indigo/atproto/syntax"
11
"github.com/gorilla/sessions"
12
"github.com/labstack/echo-contrib/session"
13
"github.com/labstack/echo/v4"
14
"gorm.io/gorm/clause"
15
+
oauth_helpers "tangled.sh/icyphox.sh/atproto-oauth/helpers"
16
)
17
18
func (s *TestServer) handleLoginSubmit(e echo.Context) error {
+2
-2
cmd/web_server_demo/main.go
+2
-2
cmd/web_server_demo/main.go
···
10
"os"
11
12
"github.com/gorilla/sessions"
13
-
oauth "github.com/haileyok/atproto-oauth-golang"
14
-
oauth_helpers "github.com/haileyok/atproto-oauth-golang/helpers"
15
_ "github.com/joho/godotenv/autoload"
16
"github.com/labstack/echo-contrib/session"
17
"github.com/labstack/echo/v4"
···
19
"github.com/urfave/cli/v2"
20
"gorm.io/driver/sqlite"
21
"gorm.io/gorm"
22
)
23
24
var (
···
10
"os"
11
12
"github.com/gorilla/sessions"
13
_ "github.com/joho/godotenv/autoload"
14
"github.com/labstack/echo-contrib/session"
15
"github.com/labstack/echo/v4"
···
17
"github.com/urfave/cli/v2"
18
"gorm.io/driver/sqlite"
19
"gorm.io/gorm"
20
+
oauth "tangled.sh/icyphox.sh/atproto-oauth"
21
+
oauth_helpers "tangled.sh/icyphox.sh/atproto-oauth/helpers"
22
)
23
24
var (
+2
-2
cmd/web_server_demo/user.go
+2
-2
cmd/web_server_demo/user.go
···
5
"fmt"
6
"time"
7
8
-
oauth "github.com/haileyok/atproto-oauth-golang"
9
-
oauth_helpers "github.com/haileyok/atproto-oauth-golang/helpers"
10
"github.com/labstack/echo-contrib/session"
11
"github.com/labstack/echo/v4"
12
)
13
14
func (s *TestServer) getOauthSession(ctx context.Context, did string) (*OauthSession, error) {
···
5
"fmt"
6
"time"
7
8
"github.com/labstack/echo-contrib/session"
9
"github.com/labstack/echo/v4"
10
+
oauth "tangled.sh/icyphox.sh/atproto-oauth"
11
+
oauth_helpers "tangled.sh/icyphox.sh/atproto-oauth/helpers"
12
)
13
14
func (s *TestServer) getOauthSession(ctx context.Context, did string) (*OauthSession, error) {
+1
-1
go.mod
+1
-1
go.mod
+2
-2
oauth.go
+2
-2
oauth.go
+1
-1
oauth_test.go
+1
-1
oauth_test.go
+1
-1
xrpc.go
+1
-1
xrpc.go