Driver contribution guide : )
gracefullight opened this issue · 2 comments
Hi @thetutlage
Can you tell me the contribution guide to add a driver?
I would like to add OAuth2 driver for Korean services such as Line, Kakao, and Naver.
I'd appreciate it if you let me know which method to implement in which file. (like socialite providers) 😅
You can use the extend method on AllyManager. Here is an example:
What I did, was create a new driver and then register it as a hook (start/hooks.js)
hooks.before.providersBooted(() => {
const AllyManager = require("@adonisjs/ally/src/AllyManager")
const MyDriver = require('../app/Lib/auth/mydriver')
AllyManager.extend('mydriver', new MyDriver())
})
You can use the other drivers as a template, as they just extend the OAuth2Scheme class.
You will also need to add the configuration to config/services.js
After that, you can use your new driver just like the others
const userData = await ally.driver('mydriver')
Will be done in the new doc.
The comment of @tannerjt is sufficient to start working on, closing this issue.