Answers for "how to send json data with 401 erroe"

0

How to send JSON Web Token (JWT Token) as header with Postman and golang

func CreateTokenEndpoint(w http.ResponseWriter, req *http.Request) {
    var user User
    _ = json.NewDecoder(req.Body).Decode(&user)
    token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
        "username": user.Username,
    })
    tokenString, error := token.SignedString([]byte("secret"))
    if error != nil {
        fmt.Println(error)
    }
    json.NewEncoder(w).Encode(JwtToken{Token: tokenString})
}
Posted by: Guest on March-13-2020
-1

send data with url in php

// Send the variables myNumber=1 and myFruit="orange" to the new PHP page...
<a href="page2.php?myNumber=1&myFruit=orange">Next page</a>
Posted by: Guest on January-31-2020

Code answers related to "how to send json data with 401 erroe"

Code answers related to "Javascript"

Browse Popular Code Answers by Language