This handler receives the ?code=<>&state=<>, uses it to get an external oauth token, gets the user's information, creates a new local user if needed, and finally mints our own tokens.
GET
/api/auth/v1/oauth/{provider}/callback
const url = 'https://example.com/api/auth/v1/oauth/example/callback?code=example&state=example';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://example.com/api/auth/v1/oauth/example/callback?code=example&state=example'Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”provider
required
string
Query Parameters
Section titled “Query Parameters”code
required
string
state
required
string
Responses
Section titled “Responses”Redirect.