Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Full OAuth & OIDC compliant API #55

Merged
merged 22 commits into from
Jan 26, 2024
Merged

Full OAuth & OIDC compliant API #55

merged 22 commits into from
Jan 26, 2024

Conversation

reesericci
Copy link
Member

@reesericci reesericci commented Jan 24, 2024

This PR adds a full OAuth API to Obl.ong, allowing clients to manage domains, records, and accounts!

Short overview of paths:

/oauth/authorize: authorization url
/oauth/token: token url
/api/v1/user: current user info
/api/v1/domains: domains
/api/v1/domains/:host: domain
/api/v1/domains/:host/records: records
/api/v1/domains/:host/records/:id: record

and more!

Closes #33

@reesericci reesericci marked this pull request as ready for review January 24, 2024 15:17
Copy link

github-actions bot commented Jan 24, 2024

Please choose an option to tip:

😁

$1.00/line: $2658.00

😄

$0.75/line: $1993.50

😃

$0.50/line: $1329.00

Or donate to the Obl.ong project

@dispherical
Copy link
Member

based

Copy link
Contributor

@cjdenio cjdenio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few random suggestions!

app/views/api/v1/domains/records/_record.json.jbuilder Outdated Show resolved Hide resolved
app/views/api/v1/user/show.json.jbuilder Outdated Show resolved Hide resolved
reesericci and others added 2 commits January 24, 2024 11:11
Co-authored-by: Caleb Denio <[email protected]>
Co-authored-by: Caleb Denio <[email protected]>
@reesericci
Copy link
Member Author

Thanks caleb!

@reesericci reesericci requested a review from cjdenio January 24, 2024 17:12
Copy link
Collaborator

@polypixeldev polypixeldev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! A few things:

  • Clicking on a provisional application seems to attempt a load and refreshes the page. Clicking should just not do anything, like provisional domains
  • undefined method domain_created_email for an instance of ActionMailer::Parameterized::Mailer when I approved a application request with the Tinder UI
  • Invalid URLs in the app request page get silently rejected
  • It scrolls all the way back up every time I submit a change on the app settings page
  • Some sort of feedback to the user when I create, copy, or delete creds/scope/redir-urls
  • Provide some docs on how to use OIDC/OAuth, even if it just links to another site that explains it well

I didn't test every API endpoint, but I did go through the auth flow and make sure it works.

app/views/admin/developers_review.html.erb Outdated Show resolved Hide resolved
reesericci and others added 4 commits January 24, 2024 17:08
Co-authored-by: Samuel Fernandez <[email protected]>
fixes:

Clicking on a provisional application seems to attempt a load and refreshes the page. Clicking should just not do anything, like provisional domains
@reesericci
Copy link
Member Author

Clicking on a provisional application seems to attempt a load and refreshes the page. Clicking should just not do anything, like provisional domains

Fixed

undefined method domain_created_email for an instance of ActionMailer::Parameterized::Mailer when I approved a application request with the Tinder UI

Fixed

Invalid URLs in the app request page get silently rejected

Added a flash message

It scrolls all the way back up every time I submit a change on the app settings page

It's a form submission, not an AJAX request - so this will not be fixed

Some sort of feedback to the user when I create, copy, or delete creds/scope/redir-urls

Added a flash message

Provide some docs on how to use OIDC/OAuth, even if it just links to another site that explains it well

That's an issue for obl-ong/docs - I'm also working on an OpenAPI spec

Copy link
Collaborator

@polypixeldev polypixeldev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • If you request an API route without putting in a token I just get a controller error, it should be 401 with a message:
    NoMethodError (undefined method `application_id' for nil):
    
    app/controllers/api/v1/api_controller.rb:14:in `not_provisional'
    
  • Flash messages stay there until reload?

REST of the GET API routes have been tested!

@reesericci
Copy link
Member Author

  • If you request an API route without putting in a token I just get a controller error, it should be 401 with a message:
NoMethodError (undefined method `application_id' for nil):
 app/controllers/api/v1/api_controller.rb:14:in `not_provisional'

Ah - this is because of the check where I tell if a client is provisional - it should just return if nil.

  • Flash messages stay there until reload?

yes its not a js toast

Copy link
Collaborator

@polypixeldev polypixeldev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@reesericci reesericci merged commit 011e5e9 into main Jan 26, 2024
4 checks passed
@reesericci reesericci deleted the api branch January 26, 2024 03:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Full OAuth REST API
4 participants