MLH / omniauth-mlh

OmniAuth strategy for MyMLH V3.
https://my.mlh.io/docs
MIT License
7 stars 8 forks source link

Upgrade Strategy to MyMLH v4 API #14

Closed jonmarkgo closed 5 days ago

jonmarkgo commented 1 week ago

Update to MyMLH API v4

This PR updates the omniauth-mlh gem to use the MyMLH API v4 endpoints and introduces several breaking changes that warrant a version bump to 2.0.0.

Changes

Breaking Changes

  1. New API Endpoints

    • The API now uses https://api.mlh.com as the base URL
    • User data is now fetched from /v4/users/me
  2. Updated Scope System

    • New granular scope system
    • Default scopes: public user:read:profile user:read:email
    • The old scope system (e.g., 'default email birthday') is no longer supported
  3. Authentication Flow

    • Only Authorization Code Flow is supported
    • Implicit Grant Flow has been removed

Test Suite Improvements

  1. Added activesupport as a development dependency to support deep_symbolize_keys functionality
  2. Updated test data structure to better match v4 API response format, including nested objects for:
    • School information
    • Company details
    • User profile data
  3. Fixed hash key transformation in tests to properly handle nested data structures
  4. Enhanced test coverage with more comprehensive API response data

Testing

Link to Devin runs:

jonmarkgo commented 6 days ago

Working MyMLH v3 example: https://gist.github.com/jonmarkgo/1881ab9da877de26c4b1a267350690d8/revisions#diff-f965f92b425fb2f75d38b491b2625fe21b8af20b7666217546bce8a42b198ea4

Working MyMLH v4 example: https://gist.github.com/jonmarkgo/1881ab9da877de26c4b1a267350690d8/revisions#diff-9ad32be17347f0cdcc9a38ac9af49d418554f067f3aac5885cf9bddfcee0556f

Note that for the v4 example, I have a tmp branch of this PR that changes the URL to beta.my.mlh.io rather than my.mlh.io