Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
229
auth_oauth.go1.51 kB
package bindings import ( "context" "github.com/Southclaws/fault" "github.com/Southclaws/fault/fctx" "github.com/Southclaws/fault/ftag" "github.com/Southclaws/storyden/app/resources/account/authentication" auth_service "github.com/Southclaws/storyden/app/services/authentication" "github.com/Southclaws/storyden/app/transports/http/openapi" ) func (o *Authentication) OAuthProviderCallback(ctx context.Context, request openapi.OAuthProviderCallbackRequestObject) (openapi.OAuthProviderCallbackResponseObject, error) { service, err := authentication.NewService(request.OauthProvider) if err != nil { return nil, fault.Wrap(err, fctx.With(ctx), ftag.With(ftag.InvalidArgument)) } provider, err := o.authManager.Provider(service) if err != nil { return nil, fault.Wrap(err, fctx.With(ctx)) } op, ok := provider.(auth_service.OAuthProvider) if !ok { return nil, fault.New("provider is not an OAuth provider", fctx.With(ctx), ftag.With(ftag.InvalidArgument)) } account, err := op.Login(ctx, request.Body.State, request.Body.Code) if err != nil { return nil, fault.Wrap(err, fctx.With(ctx)) } t, err := o.si.Issue(ctx, account.ID) if err != nil { return nil, fault.Wrap(err, fctx.With(ctx)) } return openapi.OAuthProviderCallback200JSONResponse{ AuthSuccessOKJSONResponse: openapi.AuthSuccessOKJSONResponse{ Body: openapi.AuthSuccess{Id: account.ID.String()}, Headers: openapi.AuthSuccessOKResponseHeaders{ SetCookie: o.cj.Create(*t).String(), }, }, }, nil }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server