Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: logto-io/go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: edgarsilva/logto-go-client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 4 commits
  • 15 files changed
  • 1 contributor

Commits on Jun 22, 2024

  1. Update to current mod path

    edgarsilva committed Jun 22, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4fdeca6 View commit details
  2. Updating go sum

    edgarsilva committed Jun 22, 2024
    Copy the full SHA
    83cde47 View commit details
  3. Updating go sum 2

    edgarsilva committed Jun 22, 2024
    Copy the full SHA
    dd512a3 View commit details
  4. Debugging v1

    edgarsilva committed Jun 22, 2024
    Copy the full SHA
    a6f7f21 View commit details
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import (

"golang.org/x/exp/slices"

"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
)

type AccessToken struct {
2 changes: 1 addition & 1 deletion client/client_test.go
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import (

"github.com/agiledragon/gomonkey/v2"
"github.com/go-jose/go-jose/v4"
"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
"github.com/stretchr/testify/assert"
)

7 changes: 6 additions & 1 deletion client/handle_sign_in_callback.go
Original file line number Diff line number Diff line change
@@ -2,10 +2,11 @@ package client

import (
"encoding/json"
"fmt"
"net/http"
"time"

"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
)

func (logtoClient *LogtoClient) HandleSignInCallback(request *http.Request) error {
@@ -49,6 +50,10 @@ func (logtoClient *LogtoClient) HandleSignInCallback(request *http.Request) erro
ExpiresAt: time.Now().Unix() + int64(codeTokenResponse.ExpireIn),
}

fmt.Println("---->AccessToken", codeTokenResponse.AccessToken)
fmt.Println("---->RefreshToken", codeTokenResponse.RefreshToken)
fmt.Println("---->Scope", codeTokenResponse.Scope)
fmt.Println("---->IdToken", codeTokenResponse.IdToken)
// - Treat `scopes` as `empty` to construct the default access token key
accessTokenKey := buildAccessTokenKey([]string{}, "", "")
verificationErr := logtoClient.verifyAndSaveTokenResponse(
2 changes: 1 addition & 1 deletion client/handle_sign_in_callback_test.go
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import (

"github.com/agiledragon/gomonkey/v2"
"github.com/go-jose/go-jose/v4"
"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
"github.com/stretchr/testify/assert"
)

2 changes: 1 addition & 1 deletion client/helper.go
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import (
"net/url"

"github.com/go-jose/go-jose/v4"
"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
)

func (logtoClient *LogtoClient) fetchOidcConfig() (core.OidcConfigResponse, error) {
2 changes: 1 addition & 1 deletion client/helper_test.go
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ import (
"github.com/agiledragon/gomonkey/v2"
"github.com/go-jose/go-jose/v4"
"github.com/jarcoal/httpmock"
"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
"github.com/stretchr/testify/assert"
)

2 changes: 1 addition & 1 deletion client/logto_config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package client

import (
"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
"golang.org/x/exp/slices"
)

2 changes: 1 addition & 1 deletion client/sign_in.go
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ package client
import (
"encoding/json"

"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
)

type SignInSession struct {
2 changes: 1 addition & 1 deletion client/sign_in_test.go
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import (
"testing"

"github.com/agiledragon/gomonkey/v2"
"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
"github.com/stretchr/testify/assert"
)

2 changes: 1 addition & 1 deletion client/sign_out.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package client

import (
"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
)

func (logtoClient *LogtoClient) SignOut(postLogoutRedirectUri string) (string, error) {
2 changes: 1 addition & 1 deletion client/sign_out_test.go
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import (
"testing"

"github.com/agiledragon/gomonkey/v2"
"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
"github.com/stretchr/testify/assert"
)

2 changes: 1 addition & 1 deletion client/util.go
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import (
"sort"
"strings"

"github.com/logto-io/go/core"
"github.com/edgarsilva/logto-go-client/core"
)

func GetOriginRequestUrl(request *http.Request) string {
7 changes: 2 additions & 5 deletions gin-sample/main.go
Original file line number Diff line number Diff line change
@@ -5,15 +5,13 @@ import (
"os"
"strings"

"github.com/edgarsilva/logto-go-client/client"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/memstore"
"github.com/gin-gonic/gin"
"github.com/logto-io/go/client"
)

var (
ContentTypeHtml = "text/html; charset=utf-8"
)
var ContentTypeHtml = "text/html; charset=utf-8"

func main() {
logtoConfig := &client.LogtoConfig{
@@ -84,7 +82,6 @@ func main() {
logtoClient := client.NewLogtoClient(logtoConfig, &SessionStorage{session: session})

idTokenClaims, err := logtoClient.GetIdTokenClaims()

if err != nil {
ctx.String(http.StatusOK, err.Error())
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/logto-io/go
module github.com/edgarsilva/logto-go-client

go 1.21

2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -93,8 +93,6 @@ golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 h1:LoYXNGAShUG3m/ehNk4iFctuhGX/+R1ZpfJ4/ia80JM=
golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=