Email or username:

Password:

Forgot your password?
Top-level
Dr. Quadragon ❌

@skobkin There's a RegisterApp function that supposedly returns the redirect uri, however I don't want to register a new app every time I have to log on. Do I _have_ to save it somewhere in the config then?

19 comments
Alexey Skobkin

@drq
No. It returns the URL you've specified while registering back to you. Or sets it to special value (apps.go:42).
I'd say that you should check the Mastodon OAuth docs this time.
Here:
docs.joinmastodon.org/spec/oau
And here:
docs.joinmastodon.org/methods/

BTW I forgot that you can also just show the code to the user without redirection, so you still can implement the "app"/"server" flow without web endpoints. Check this second link for such example.

So your flow could be like:
- Get auth URL from the bot
- Go there, enter your creds
- Copy the code from the browser
- Enter it to your bot
- Bot retrieves an access token and stores it somewhere.

And if you're planning to register the bot as an app from itself then you also need to store the app credentials.

@drq
No. It returns the URL you've specified while registering back to you. Or sets it to special value (apps.go:42).
I'd say that you should check the Mastodon OAuth docs this time.
Here:
docs.joinmastodon.org/spec/oau
And here:
docs.joinmastodon.org/methods/

BTW I forgot that you can also just show the code to the user without redirection, so you still can implement the "app"/"server" flow without web endpoints. Check this second link for such example.

Alexey Skobkin

@drq
And if it's still not clear, in the case without endpoints you can just leave redirect URL empty and it'll be replaced by that 'magic' value 'urn:ietf:wg:oauth:2.0:oob' which will lead to the auth code (not token!) to be displayed to the user (you) after entering your login and password in the browser.

Dr. Quadragon ❌

@skobkin Yeah, so I need to rewrite the configuration routine according to that. Thanks.

Alexey Skobkin

@drq
Yes, something like that.
You can probably just add two commands to your bot like:

./bot login # prints URL
./bot retrieve-token <code> # takes code, gets token and then stores it.

Alexey Skobkin

@drq
Also probably
./bot register-app

But it could be done in the 'login' command easily, so it's not necessary.

Alexey Skobkin

@drq
Did you get it to work in the end?

lionalex replied to Alexey

@skobkin @drq

Guys, I'd like to use your expertise a bit :)
I'm totally new in fediverse, and I'd like to create an ActivityPub server with my own content and make it accessible via Mastodon. What should I start from?
What libs do you suggest? (preferable in Go)

Alexey Skobkin replied to lionalex

@lionalex @drq
You should ask @grishka about that. He wrote some nice post about basics of ActivityPub for humans.

Considering the libraries, I'm not so sure. I'd start with looking for existing AP projects in Go and checked out which libraries they use.

Григорий Клюшников replied to Alexey

Alexey Skobkin, I was meaning to write about ActivityPub but have never gotten around to doing that. There were two posts by Eugen about building a minimal ActivityPub server in Ruby (but trivially portable to any language). I send links to them to anyone who wants to get started quickly.

Григорий Клюшников replied to Alexey

Alexey Skobkin, one thing to keep in mind tho: they are outdated and if you follow them as is your implementation won't work with modern Mastodon. The Digest header is now required. It's a sha256 of the request body and you need to include it in the signature as well.

lionalex replied to Григорий

@grishka @skobkin @drq

Thank you, guys! Will take a closer look.

What I'm thinking about is a kinda federative media. Someone writes an article on the media's ActivityPub server. The problem here is censorship. The server could be banned by RKN and it would be great to read the article via other servers in the federation.

For instance, it could be a mobile app that connects to a random server (without auth) and use it to get access to the article.

Dr. Quadragon ❌ replied to lionalex

@lionalex Make federated Livejournal

@ludivokrug would be thankful for that

@grishka @skobkin

lionalex replied to Dr. Quadragon ❌

@drq @ludivokrug @grishka @skobkin
That's an option, but the problem is the number of servers and it would be great to utilize existing infrastructure

Alexey Skobkin replied to lionalex

@lionalex @drq @ludivokrug @grishka

I'm not sure if what're you planning to do is the same as for what purpose ActivityPub was created.

Dr. Quadragon ❌ replied to lionalex

@lionalex there's a go-fed library, although some may not be happy about its quality

@skobkin

Go Up