Is it possible to login with GitHub Sponsors

Hi, I would like to restrict only GitHub sponsors from logging in.

I can check if a user is a sponsor via the GraphQL API. Is it possible to integrate this check into the login process?

query {
  user(login:"USERNAME") {
    sponsorshipForViewerAsSponsorable(activeOnly:true) {
    	tier {
        name
        monthlyPriceInDollars
      }  
    }
  }
}

Hi @razonyang

Welcome back to the Auth0 Community!

I am sorry about the late reply to your inquiry.

By using a PostLogin Action, you can make a call to the GraphQL API in order to check if the user is a sponsor of Github and allow them access to the application.

exports.onExecutePostLogin = async (event, api) => {

//login that retrieves user's sponsor status comes here

if(event.connection.strategy ==="github"){
  if(!isGitHubSponsor){
    api.deny.access("Only Github sponors are allowed")
  }
}
}

If you have any other questions, feel free to leave a reply or post again on the community!

Kind Regards.
Nik

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.