oauth
Last updated
Was this helpful?
Last updated
Was this helpful?
(plugins.oauth)
The OAuth
plugin simplifies authentication and access to protected resources using OAuth protocols. It supports integration with predefined OAuth providers or custom APIs, enabling secure communication between applications and external services. Core functionalities include creating OAuth services, managing access tokens, and executing authenticated requests.
OAuth services can be configured through the serviceBuilder
, which allows the definition of parameters such as client ID, client secret, scope, and state for secure sessions. The service builder also facilitates the integration of callback methods for handling responses. For more specific use cases, developers can build custom APIs by defining authorization and token endpoints, ensuring flexibility for various authentication workflows.
The plugin provides utility methods to streamline the process. It can generate redirect URLs for configuration on provider platforms and manage token extraction from responses. Once authenticated, OAuth services enable the execution of HTTP requests to protected endpoints, supporting various data formats such as JSON and binary. The plugin also facilitates error handling by capturing and relaying issues related to authentication or access requests.
By integrating the OAuth
plugin, applications can securely authenticate users, access external APIs, and handle sensitive data interactions while adhering to modern security standards.
,,,,,,,,,,
Create a custom OAuth api builder.
Creates an OAuth service that can be used to obtain an access token and access protected data.
Help method to get the redirect URL which needs to be configured on the OAuth provider application page.
Creates an OAuth service configurator.
Create a custom OAuth api builder.
Parameters
Sample
Creates an OAuth service that can be used to obtain an access token and access protected data. This method will be deprecated in the following versions, the preferred way is plugins.oauth.serviceBuilder with a callback function.
Parameters
Sample
Help method to get the redirect URL which needs to be configured on the OAuth provider application page. The url is computed based on what is set on the service builder: deeplink method name, response mode and response type.
Parameters
Creates an OAuth service configurator.
Parameters
Sample
authorizationBaseUrl the base URL where you should redirect your users to authenticate your application
accessTokenEndpoint the URL that receives the access token requests
Returns: a custom API builder for OAuth.
provider an OAuth provider id, see plugins.oauth.OAuthProviders
clientId your app id
clientSecret your client secret
scope configures the OAuth scope. This is only necessary in some APIs (like Microsoft's).
state configures the anti forgery session state. This is available in some APIs (like Facebook's).
deeplinkmethod the name of a global method, which will get the code returned by the OAuth provider
Returns: the OAuthService.
builder an OAuth service builder
Returns: the redirect URL used by the OAuth service builder.
clientID ;
Returns: an OAuth service builder object