- Call /create
- Insert data into verify table
- Generate jwt with short expiration
- Send confirm Mail with code
- Call /verify
- Check jwt
- Check verify code
- Generate jwt
- Move data from verify table to user table
- Call /login
- Check password
- Generate jwt
- Call /Oauth
- Redirect to google oauth2.0
- Generate jwt
- if needed, add data to user table
request
type requestLoginBody struct {
Email string
Password string
}
response
200 statusOK
Token(jwt,exp 3 month)
500 statusInternalServerError
401 statusUnauthorized
400 statusBadRequest
request
type requestCreateBody struct {
Email string
Password string
DisplayName string
}
response
200 statusOK
Token(jwt,exp 5 min)
500 statusInternalServerError
401 statusUnauthorized
400 statusBadRequest
request
type requestVerifyBody struct {
token string
code string
}
response
200 statusOK
Token(jwt,exp 3 month)
500 statusInternalServerError
401 statusUnauthorized
400 statusBadRequest
Oauth redirect function
Oauth callback function
200 statusOK
Token(jwt,exp 3 month)
request
type requestPost struct {
Token string
Latitude float64
Longitude float64
Content string
ImageURL string
}
response
200 statusOK
500 statusInternalServerError
401 statusUnauthorized
400 statusBadRequest
request
type requestDelete struct {
Token string
PostId string
}
response
200 statusOK
500 statusInternalServerError
401 statusUnauthorized
400 statusBadRequest
request
type requestGet struct {
Token string
Latitude float64
Longitude float64
}
response
200 statusOK
[]ResponseGet
type ResponseGet struct {
PostId string `json:"postId"`
DisplayName string `json:"displayName"`
Content string `json:"content"`
ImageURL string `json:"imageUrl"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Address string `json:"address"`
ConstructionName string `json:"constructionName"`
roadName string `json:"roadName"`
}
500 statusInternalServerError
401 statusUnauthorized
400 statusBadRequest
$ git clone https://github.com/achyu-nitkc/achyuBackend.git
$ cd achyuBackend
# ADD SECRET FILE
$ sudo docker build -t achyu .
$ sudo docker run -p 8080:8080 achyu
auth/jwtSecret.go
package auth
func jwtSecret() []byte {
return []byte("")
}
auth/oAuthSecret.go
package auth
//https://cloud.google.com/apigee/docs/api-platform/security/oauth/access-tokens?hl=ja
func oauthSecret() (ClientID, ClientSecret string) {
clientID := ""
clientSecret := ""
return clientID, clientSecret
}
func oauthStateString() string {
return ""
}
auth/smtpConfig.go
package auth
//Get application password
//https://myaccount.google.com/apppasswords
func config() (hostname string, port int, username string, password string) {
return "smtp.gmail.com", 587, "Your Email Address", "Your Application Password"
}
yolp/yolpSecret.go
package yolp
func secret() string {
return "appid="+"Your Client Id"
}