Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/oauth/callback/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/obot-platform/mcp-oauth-proxy/pkg/mcpui"
"github.com/obot-platform/mcp-oauth-proxy/pkg/providers"
"github.com/obot-platform/mcp-oauth-proxy/pkg/types"
"golang.org/x/oauth2"
)

type Store interface {
Expand Down Expand Up @@ -195,6 +196,8 @@ func (p *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
"expires_at": tokenInfo.Expiry.Unix(),
}

extractSpecialProps(tokenInfo, sensitiveProps)

// Only add user info if we have it
if needsUserInfo {
sensitiveProps["email"] = userInfo.Email
Expand Down Expand Up @@ -328,3 +331,11 @@ func (p *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Location", parsedURL.String())
w.WriteHeader(http.StatusFound)
}

func extractSpecialProps(tokenInfo *oauth2.Token, props map[string]any) {
// Salesforce instance URL
url := tokenInfo.Extra("instance_url")
if v, ok := url.(string); ok && v != "" {
props["instance_url"] = v
}
}
7 changes: 7 additions & 0 deletions pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,13 @@ func setHeaders(header http.Header, props map[string]any) {
} else {
header.Del("X-Forwarded-Access-Token")
}

// Salesforce instance URL
if instanceURL, ok := props["instance_url"].(string); ok {
header.Set("X-Forwarded-Instance-URL", instanceURL)
} else {
header.Del("X-Forwarded-Instance-URL")
}
}

// updateGrant updates a grant with new token information
Expand Down
Loading