Skip to content

Instantly share code, notes, and snippets.

package main
import (
"io/ioutil"
"log"
"net/http"
"os"
"strings"
)
var endpoint *string
cognitoEndpoint = os.Getenv("COGNITO_ENDPOINT")
if cognitoEndpoint != "" {
endpoint = aws.String(cognitoEndpoint)
}
client := cognitoidentityprovider.New(
session.Must(session.NewSessionWithOptions(session.Options{
Config: aws.Config{Endpoint: endpoint},
SharedConfigState: session.SharedConfigEnable,
})),
package main
import (
"crypto/rsa"
"encoding/base64"
"encoding/binary"
"encoding/json"
"fmt"
"io/ioutil"
"log"
import (
"encoding/json"
"fmt"
"math/rand"
"github.com/aws/aws-sdk-go/service/cognitoidentityprovider"
"github.com/gofrs/uuid"
)
import (
"crypto/rsa"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"time"
"github.com/aws/aws-sdk-go/service/cognitoidentityprovider"
"github.com/dgrijalva/jwt-go"
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
"github.com/go-chi/chi/v5"
"github.com/go-chi/render"
)
{
"user-pool-id-hoge": {
"username-hoge": {
"uuid": "208b377c-e86e-3f1d-a23c-cdab84d86901",
"password": "password",
"username": "username-hoge",
"email": "email@example.com",
"email_verified": true
}
}
import (
"encoding/json"
"fmt"
"sync"
)
const poolFileName = "pool.json"
func main() {
data, err := ioutil.ReadFile(poolFileName)
import (
"fmt"
"log"
"net/http"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
)
func main() {
import (
"encoding/base64"
"encoding/binary"
"encoding/json"
"io/ioutil"
"github.com/dgrijalva/jwt-go"
)
const jwkKeyID = "hoge"