Skip to content

Commit

Permalink
Implement scopes (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
etoledom authored Sep 13, 2024
1 parent 7c9cb44 commit 70bf62b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Gravatar/Network/Services/ProfileService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public struct Avatar: Decodable, Sendable {
}

public var url: String {
"https://gravatar.com\(imageUrl)?size=256"
imageUrl
}
}

Expand Down
17 changes: 17 additions & 0 deletions Sources/GravatarUI/SwiftUI/OAuthSession/OAuthSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,30 @@ private struct OAuthURLParams: Encodable {
let blogID: String
let redirectURI: String
let userEmail: String
var scope1: String
var scope2: String
var scope3: String

public enum CodingKeys: String, CodingKey, CaseIterable {
case clientID
case responseType
case blogID
case redirectURI
case userEmail
case scope1 = "scope[1]"
case scope2 = "scope[2]"
case scope3 = "scope[3]"
}

init(email: Email, secrets: Configuration.OAuthSecrets) {
self.clientID = secrets.clientID
self.responseType = "code"
self.blogID = "0"
self.redirectURI = secrets.redirectURI
self.userEmail = email.rawValue
self.scope1 = "gravatar-profile:read"
self.scope2 = "gravatar-profile:manage"
self.scope3 = "auth"
}
}

Expand Down

0 comments on commit 70bf62b

Please sign in to comment.