mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-17 01:59:08 +00:00
finish login story
This commit is contained in:
parent
a23184efd2
commit
c9cb4c95bc
34 changed files with 14564 additions and 21666 deletions
20
src/common/types/User.go
Normal file
20
src/common/types/User.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package types
|
||||
|
||||
type DiscordUser struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
Discriminator string `json:"discriminator,omitempty"`
|
||||
Avatar string `json:"avatar,omitempty"`
|
||||
Bot bool `json:"bot,omitempty"`
|
||||
}
|
||||
|
||||
type Member struct {
|
||||
GuildID string `json:"guildid,omitempty"`
|
||||
Roles []string `json:"rolesList,omitempty"`
|
||||
Nick string `json:"nick,omitempty"`
|
||||
User DiscordUser `json:"user,omitempty"`
|
||||
}
|
||||
|
||||
type RoleypolyUser struct {
|
||||
DiscordUser DiscordUser `json:"discorduser,omitempty"`
|
||||
}
|
31
src/common/types/session.go
Normal file
31
src/common/types/session.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
package types
|
||||
|
||||
import "time"
|
||||
|
||||
// CreateSessionRequest is the payload to /create-session
|
||||
type CreateSessionRequest struct {
|
||||
AccessTokenResponse AccessTokenResponse
|
||||
Fingerprint Fingerprint
|
||||
}
|
||||
|
||||
type Fingerprint struct {
|
||||
UserAgent string
|
||||
ClientIP string
|
||||
ForwardedFor string
|
||||
}
|
||||
|
||||
type CreateSessionResponse struct {
|
||||
SessionID string
|
||||
}
|
||||
|
||||
type SessionData struct {
|
||||
SessionID string
|
||||
Fingerprint Fingerprint
|
||||
AccessTokens AccessTokenResponse
|
||||
UserData UserData
|
||||
}
|
||||
|
||||
type UserData struct {
|
||||
DataExpires time.Time
|
||||
UserID string
|
||||
}
|
10
src/common/types/tokens.go
Normal file
10
src/common/types/tokens.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
package types
|
||||
|
||||
// AccessTokenResponse is the response for Discord's OAuth token grant flow
|
||||
type AccessTokenResponse struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
TokenType string `json:"token_type"`
|
||||
ExpiresIn int `json:"expires_in"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
Scope string `json:"scope"`
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue